def start(self): ''' Start child process ''' from multiprocessing.process import _current_process, _cleanup assert self._popen is None, 'cannot start a process twice' assert self._parent_pid == os.getpid(), \ 'can only start a process object created by current process' _cleanup() self._popen = self._Popen(self) self._sentinel = self._popen.sentinel _current_process._children.add(self)
def start(self): ''' Start child process ''' assert self._popen is None, 'cannot start a process twice' assert self._parent_pid == os.getpid(), \ 'can only start a process object created by current process' assert not _current_process._daemonic, \ 'daemonic processes are not allowed to have children' #_cleanup() process._cleanup() if self._Popen is not None: Popen = self._Popen else: #from .forking import Popen #bjf> have replaced the Popen class from 'forking' Popen = Popenmod self._popen = Popen(self) _current_process._children.add(self)
def start(self): """ Start child process """ assert self._popen is None, 'cannot start a process twice' assert self._parent_pid == os.getpid(), \ 'can only start a process object created by current process' # This is the code I'm commenting out and allows me to perform the # dangerous task of forking inside a daemon process. """ assert not current_process()._daemonic, \ 'daemonic processes are not allowed to have children' """ _cleanup() if self._Popen is not None: Popen = self._Popen else: from multiprocessing.forking import Popen self._popen = Popen(self) current_process()._children.add(self)
def _cleanup_tests(): """Cleanup multiprocessing resources when multiprocessing tests completed.""" from test import support # cleanup multiprocessing process._cleanup() # Stop the ForkServer process if it's running from multiprocessing import forkserver forkserver._forkserver._stop() # Stop the ResourceTracker process if it's running from multiprocessing import resource_tracker resource_tracker._resource_tracker._stop() # bpo-37421: Explicitly call _run_finalizers() to remove immediately # temporary directories created by multiprocessing.util.get_temp_dir(). _run_finalizers() support.gc_collect() support.reap_children()