def per_process_init():
# type: () -> None
try:
os.nice(19)
except AttributeError:
# nice is not available everywhere.
pass
except OSError:
# When this program is already running on the nicest level (20) on OS X
# it is not permitted to change the priority.
pass
# A keyboard interrupt disrupts the communication between a
# Python script and its subprocesses when using multiprocessing.
# The child can ignore SIGINT and is properly shut down
# by a pool.terminate() call in case of a keyboard interrupt
# or an early generator exit.
signal.signal(signal.SIGINT, signal.SIG_IGN)
评论列表
文章目录