Interrupt python thread

James Matthews nytrokiss at gmail.com
Sun Aug 24 14:48:20 EDT 2008


Group all the threads in a list and call the stop method on all of them.

On Sun, Aug 24, 2008 at 1:48 AM, BlueBird <phil at freehackers.org> wrote:

> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://www.goldwatches.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080824/625b3b5f/attachment-0001.html>


More information about the Python-list mailing list