thread, threading; how to kill a thread?

JCM joshway_without_spam at myway.com
Wed Nov 17 14:21:31 EST 2004


Jerry Sievers <jerry at jerrysievers.com> wrote:
> Greetings Pythonists;

> I have limited experience with threaded apps and plenty with old style
> forked heavyweight multi-processing apps.

> Using Python 2.3.3 on a Redhat 7.x machine.

> Wondering if there is a simple way from a main python program to kill
> a running thread?

Sort of.  You can send a unix signal to the main thread (it causes an
exception which you can catch).  But as others have and will surely
point out, it's usually better to have your thread occasionally check
whether it should die, so it doesn't leave anything in a bad state.



More information about the Python-list mailing list