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()
     if self._Popen is not None:
         Popen = self._Popen
     else:
         from multiprocessing.forking import Popen
     self._popen = Popen(self)
     _current_process._children.add(self)
Exemple #2
0
    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)