thread, threading; how to kill a thread?
ianb at colorstudy.com
Wed Nov 17 23:41:49 CET 2004
David Bolen wrote:
> Ian Bicking <ianb at colorstudy.com> writes:
>>Even if it messes things up and I have to restart the process at the
>>soonest possible time to clean up the problems, it would be nice to be
>>able to exit the process. (...)
> I'm not positive, but os._exit() may at least let you get the process
> exited regardless of any thread states.
Indeed, sir, you are right! Thanks.
I whipped up something to try to do the right thing (sys.exit), unless
things go badly, then do the wrong thing (os._exit):
In Webware we usually run the server so that if it exits with an error
code of 3, the server gets restarted. (In other setups you might always
restart the server.) Anyway, this way we could actually test if there
were wedged threads, and restart the whole server if so. At the same
time, most resources should be properly freed.
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Python-list