summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/popen_fork.py
diff options
context:
space:
mode:
authorThomas Moreau <thomas.moreau.2010@gmail.com>2019-05-20 19:37:05 (GMT)
committerAntoine Pitrou <antoine@python.org>2019-05-20 19:37:05 (GMT)
commitc09a9f56c08d80567454cae6f78f738a89e1ae94 (patch)
tree7f00233cfa994ba74ca952d371ae85651690602a /Lib/multiprocessing/popen_fork.py
parent5ae1c84bcd13b766989fc3f1e1c851e7bd4c1faa (diff)
downloadcpython-c09a9f56c08d80567454cae6f78f738a89e1ae94.zip
cpython-c09a9f56c08d80567454cae6f78f738a89e1ae94.tar.gz
cpython-c09a9f56c08d80567454cae6f78f738a89e1ae94.tar.bz2
bpo-36888: Add multiprocessing.parent_process() (GH-13247)
Diffstat (limited to 'Lib/multiprocessing/popen_fork.py')
-rw-r--r--Lib/multiprocessing/popen_fork.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/multiprocessing/popen_fork.py b/Lib/multiprocessing/popen_fork.py
index 685e8da..11e2160 100644
--- a/Lib/multiprocessing/popen_fork.py
+++ b/Lib/multiprocessing/popen_fork.py
@@ -66,16 +66,20 @@ class Popen(object):
def _launch(self, process_obj):
code = 1
parent_r, child_w = os.pipe()
+ child_r, parent_w = os.pipe()
self.pid = os.fork()
if self.pid == 0:
try:
os.close(parent_r)
- code = process_obj._bootstrap()
+ os.close(parent_w)
+ code = process_obj._bootstrap(parent_sentinel=child_r)
finally:
os._exit(code)
else:
os.close(child_w)
- self.finalizer = util.Finalize(self, os.close, (parent_r,))
+ os.close(child_r)
+ self.finalizer = util.Finalize(self, util.close_fds,
+ (parent_r, parent_w,))
self.sentinel = parent_r
def close(self):