diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-10-16 15:41:56 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-10-16 15:41:56 (GMT) |
commit | b1694cf588ca915c003b9b79c9fdeab82deb9476 (patch) | |
tree | 923f376dd771dbc25815cad0708c753ef3af3b14 /Lib/multiprocessing/popen_forkserver.py | |
parent | 3e4b52875e0162b536817da93f54b1988195c3ab (diff) | |
download | cpython-b1694cf588ca915c003b9b79c9fdeab82deb9476.zip cpython-b1694cf588ca915c003b9b79c9fdeab82deb9476.tar.gz cpython-b1694cf588ca915c003b9b79c9fdeab82deb9476.tar.bz2 |
Issue #18999: Make multiprocessing use context objects.
This allows different parts of a program to use different methods for
starting processes without interfering with each other.
Diffstat (limited to 'Lib/multiprocessing/popen_forkserver.py')
-rw-r--r-- | Lib/multiprocessing/popen_forkserver.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/multiprocessing/popen_forkserver.py b/Lib/multiprocessing/popen_forkserver.py index f1c4b57..b115f81 100644 --- a/Lib/multiprocessing/popen_forkserver.py +++ b/Lib/multiprocessing/popen_forkserver.py @@ -4,8 +4,8 @@ import os from . import reduction if not reduction.HAVE_SEND_HANDLE: raise ImportError('No support for sending fds between processes') +from . import context from . import forkserver -from . import popen from . import popen_fork from . import spawn from . import util @@ -42,12 +42,12 @@ class Popen(popen_fork.Popen): def _launch(self, process_obj): prep_data = spawn.get_preparation_data(process_obj._name) buf = io.BytesIO() - popen.set_spawning_popen(self) + context.set_spawning_popen(self) try: reduction.dump(prep_data, buf) reduction.dump(process_obj, buf) finally: - popen.set_spawning_popen(None) + context.set_spawning_popen(None) self.sentinel, w = forkserver.connect_to_new_process(self._fds) util.Finalize(self, os.close, (self.sentinel,)) @@ -67,9 +67,3 @@ class Popen(popen_fork.Popen): # The process ended abnormally perhaps because of a signal self.returncode = 255 return self.returncode - - @staticmethod - def ensure_helpers_running(): - from . import semaphore_tracker - semaphore_tracker.ensure_running() - forkserver.ensure_running() |