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_spawn_posix.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_spawn_posix.py')
-rw-r--r-- | Lib/multiprocessing/popen_spawn_posix.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Lib/multiprocessing/popen_spawn_posix.py b/Lib/multiprocessing/popen_spawn_posix.py index 751bf22..8b5dc42 100644 --- a/Lib/multiprocessing/popen_spawn_posix.py +++ b/Lib/multiprocessing/popen_spawn_posix.py @@ -2,7 +2,7 @@ import fcntl import io import os -from . import popen +from . import context from . import popen_fork from . import reduction from . import spawn @@ -41,16 +41,16 @@ class Popen(popen_fork.Popen): def _launch(self, process_obj): from . import semaphore_tracker - tracker_fd = semaphore_tracker._semaphore_tracker_fd + tracker_fd = semaphore_tracker.getfd() self._fds.append(tracker_fd) prep_data = spawn.get_preparation_data(process_obj._name) fp = io.BytesIO() - popen.set_spawning_popen(self) + context.set_spawning_popen(self) try: reduction.dump(prep_data, fp) reduction.dump(process_obj, fp) finally: - popen.set_spawning_popen(None) + context.set_spawning_popen(None) parent_r = child_w = child_r = parent_w = None try: @@ -70,8 +70,3 @@ class Popen(popen_fork.Popen): for fd in (child_r, child_w, parent_w): if fd is not None: os.close(fd) - - @staticmethod - def ensure_helpers_running(): - from . import semaphore_tracker - semaphore_tracker.ensure_running() |