Killing a thread
Just van Rossum
just at letterror.com
Fri Aug 4 15:13:32 EDT 2000
Gordon McMillan wrote:
>
> pauljolly at my-deja.com wrote in <8mduck$a7o$1 at nnrp1.deja.com>:
>
> >Thanks, but this does not kill the thread. I have tried this within the
> >python shell.
>
> You don't kill threads. You ask them to exit. If you did manage to kill a
> thread, you would likely screw up your entire process, because there's no
> clean up code to free resources or let go of locks etc.
In the later versions of the uthread module for stackless, if you kill
another thread, a SystemExit exception is posted to that thread: that
seems fairly clean. I wonder if such behavior could be done with
system-level threads as well?
> Note that Java has deprecated killing threads; not just because of the
> above reasons, but also because it usually didn't work - if the thread was
> doing a blocking call, on most OSes it wouldn't die until it returned from
> the call.
Hm, that's indeed a show stopper...
Just
More information about the Python-list
mailing list