Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
21ef540c
Commit
21ef540c
authored
Mar 24, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #155: parent: split create_socketpair() from create_child()
parent
c31a177e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
mitogen/parent.py
mitogen/parent.py
+10
-1
No files found.
mitogen/parent.py
View file @
21ef540c
...
...
@@ -122,7 +122,7 @@ def close_nonstandard_fds():
pass
def
create_
child
(
*
args
):
def
create_
socketpair
(
):
parentfp
,
childfp
=
socket
.
socketpair
()
parentfp
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_SNDBUF
,
...
...
@@ -130,8 +130,17 @@ def create_child(*args):
childfp
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_RCVBUF
,
mitogen
.
core
.
CHUNK_SIZE
)
return
parentfp
,
childfp
def
create_child
(
*
args
):
parentfp
,
childfp
=
create_socketpair
()
pid
=
os
.
fork
()
if
not
pid
:
# When running under a monkey patches-enabled gevent, the socket module
# yields file descriptors who already have O_NONBLOCK, which is
# persisted across fork, totally breaking Python. Therefore, drop
# O_NONBLOCK from Python's future stdin fd.
mitogen
.
core
.
set_block
(
childfp
.
fileno
())
os
.
dup2
(
childfp
.
fileno
(),
0
)
os
.
dup2
(
childfp
.
fileno
(),
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment