示例#1
0
    def doRead(self):
        """
        Having woken up the reactor in response to receipt of
        C{SIGCHLD}, reap the process which exited.

        This is called whenever the reactor notices the waker pipe is
        writeable, which happens soon after any call to the C{wakeUp}
        method.
        """
        _FDWaker.doRead(self)
        process.reapAllProcesses()
示例#2
0
 def tearDown(self):
     """
     Restore the original SIGCHLD handler and reap processes as long as
     there seem to be any remaining.
     """
     if self.originalHandler is not None:
         signal.signal(signal.SIGCHLD, self.originalHandler)
     if process is not None:
         while process.reapProcessHandlers:
             log.msg("ReactorBuilder.tearDown reaping some processes %r" %
                     (process.reapProcessHandlers, ))
             process.reapAllProcesses()
示例#3
0
 def tearDown(self):
     """
     Restore the original SIGCHLD handler and reap processes as long as
     there seem to be any remaining.
     """
     if self.originalHandler is not None:
         signal.signal(signal.SIGCHLD, self.originalHandler)
     if process is not None:
         while process.reapProcessHandlers:
             log.msg(
                 "ReactorBuilder.tearDown reaping some processes %r" % (
                     process.reapProcessHandlers,))
             process.reapAllProcesses()
示例#4
0
 def _handleSignals(self):
     """
     Extend the basic signal handling logic to also support
     handling SIGCHLD to know when to try to reap child processes.
     """
     _SignalReactorMixin._handleSignals(self)
     if platformType == 'posix':
         if not self._childWaker:
             self._childWaker = _SIGCHLDWaker(self)
             self._internalReaders.add(self._childWaker)
             self.addReader(self._childWaker)
         self._childWaker.install()
         # Also reap all processes right now, in case we missed any
         # signals before we installed the SIGCHLD waker/handler.
         # This should only happen if someone used spawnProcess
         # before calling reactor.run (and the process also exited
         # already).
         process.reapAllProcesses()