Killing threads

Joshua Marshall jmarshal at mathworks.com
Fri Mar 16 13:09:32 EST 2001


costas at meezon.com wrote:
> I have th program below. How does one go about kill a thread once
> started? Why is there no method for killing threads? I thought del
> would do it but obviously it doesn't.

I'd like to see this too.

There are the standard responses about how to go about killing threads
(for example having some variable like 'kill_yourself' which the
thread checks every so often), but there genuinely are times that
killing a thread is useful, like if a thread is running code that you
don't have control over.

One thing you can do on unix platforms is send a signal to the main
thread, if that happens to be the one you're interested in killing.



More information about the Python-list mailing list