Catch KeyboardInterrupt or handle signal in thread
问题 I have some threads running, and one of those threads contains an object that will be spawning subprocesses. I want one such subprocess to be able to kill the entire application. The aforementioned object will need to save some state when it receives this signal. Unfortunately I can't get the signal to be handled in the thread that causes the kill. Here is some example code that attempts to replicate the situation. parent.py : starts a thread. that thread runs some subprocesses, one of which