Capturing SIGINT in multithreaded python
Multithreaded Python scripts doesn’t always respond to signals. This is because it is not defined which thread will receive the signal. Also, it seems that if a thread is sleeping the signal might be interrupted altogether. The sympton of this that I saw the most often was that the script deadlocked and had to be killed.
Activestate contains a more thorough discussion of this together with code for a signal handler that catches SIGINTS and aborts the process.
