mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
bpo-36888: Add multiprocessing.parent_process() (GH-13247)
This commit is contained in:
parent
5ae1c84bcd
commit
c09a9f56c0
12 changed files with 155 additions and 20 deletions
|
@ -49,7 +49,11 @@ class Popen(popen_fork.Popen):
|
|||
set_spawning_popen(None)
|
||||
|
||||
self.sentinel, w = forkserver.connect_to_new_process(self._fds)
|
||||
self.finalizer = util.Finalize(self, os.close, (self.sentinel,))
|
||||
# Keep a duplicate of the data pipe's write end as a sentinel of the
|
||||
# parent process used by the child process.
|
||||
_parent_w = os.dup(w)
|
||||
self.finalizer = util.Finalize(self, util.close_fds,
|
||||
(_parent_w, self.sentinel))
|
||||
with open(w, 'wb', closefd=True) as f:
|
||||
f.write(buf.getbuffer())
|
||||
self.pid = forkserver.read_signed(self.sentinel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue