Is it possible to kill a thread ?

{-- Rot13 - Hateme ungrzr2 at ubatxbat.pbz
Fri Dec 7 02:18:40 CET 2001


grante at visi.com (Grant Edwards) wrote in
news:slrna0vkoe.u69.grante at grante.comtrol.com: 

> The problem with this is that one often creates a thread so
> that it can do some possibly blocking operation without
> stopping the rest of the program.  If the thread is blocked, it
> can't check the event.  If the thread isn't going to block,
> then why create a thread?  [Yes, there are other reasons for
> splitting something into a thread, but in many cases I create a
> thread specifically because it's goign to block.]
> 

exactly. It seems calling os._exit(1) kills everything
under linux and windows include everything. :)

Don't know how to kill one thread only.
I use it when my threads are doing blocked socket operation.
We can not tell a blocked socket that 'I want stop'. So
there are situation where kill thread is needed.

But I cannot catch the KeyboardInterrupt from my main
thread under windows, so have to loop over a raw_input
to get exit order.



More information about the Python-list mailing list