def _exitFunction(): from processing.finalize import _runFinalizers from processing.logger import info _current_process._exiting = True info('running all "atexit" finalizers with priority >= 0') _runFinalizers(0) for p in activeChildren(): if p._daemonic: info('calling `terminate()` for daemon %s', p.getName()) p._popen.terminate() for p in activeChildren(): info('calling `join()` for process %s', p.getName()) p.join() info('running the remaining "atexit" finalizers') _runFinalizers()
def shutdown(self, c): ''' Shutdown this process ''' c.send(('#RETURN', None)) info('manager received shutdown message') # do some cleaning up _runFinalizers(0) for p in activeChildren(): debug('terminating a child process of manager') p.terminate() for p in activeChildren(): debug('terminating a child process of manager') p.join() _runFinalizers() info('manager exiting with exitcode 0') # now exit without waiting for other threads to finish exit(0)