Interrupt python thread

BlueBird phil at freehackers.org
Sun Aug 24 04:48:46 EDT 2008


Hi,

I have a program with a master thread and several slave threads.

Whenever an exception occurs, in the master thread or in one of the
slave threads, I would like to interrupt all the threads and the main
program. Threading API does not seem to provide a way to stop a
thread, is there anyway to achieve that ?

The closest thing I found is thread.interrupt_main() but it's far from
perfect :
- it only allow to interrupt the main thread
- if the main thread is sleeping, it does not interrupt it (at least
on windows)

    cheers,

    Philippe



More information about the Python-list mailing list