killing thread ?

Paul Rubin phr-n2003b at NOSPAMnightsong.com
Fri Jan 24 16:18:22 CET 2003


"Martin v. Löwis" <martin at v.loewis.de> writes:
> > But what if I want to end a thread which hangs because
> > it uses 'exec' on some code which loops forever ?
> 
> You lose. There is no way to cancel a thread, period.

Is there some inherent reason for that?  Or is it just a deficiency,
either in Python or in the way OS threads work?  I don't understand
why Python's thread switching code can't just look for a flag
indicating that the thread should be killed instead of allowed to run.




More information about the Python-list mailing list