def terminationHandler(cls, signal=None, frame=None, terminate=True):
"""Signal termination handler
signal - raised signal
frame - origin stack frame
terminate - whether to terminate the application
"""
#if signal == signal.SIGABRT:
# os.killpg(os.getpgrp(), signal)
# os.kill(os.getpid(), signal)
if cls._execpool:
del cls._execpool # Destructors are caled later
# Define _execpool to avoid unnessary trash in the error log, which might
# be caused by the attempt of subsequent deletion on destruction
cls._execpool = None # Note: otherwise _execpool becomes undefined
if terminate:
sys.exit() # exit(0), 0 is the default exit code.
评论列表
文章目录