How should threads be terminated? (related to 'Help with thread related tracebacks')

Brian desertgarden at netscape.com
Thu Jun 16 12:45:47 EDT 2005


Hi Maxwell,

Yes, to terminate a thread in Python early, use the following:

      import sys; sys.exit(0)

This kills the particular thread without wiping out the entire Python 
application.

Hope this helps,

Brian  :-)
---


Maxwell Hammer wrote:
> Hi all,
> 
> This is related to an earlier post 'Help with thread related
> tracebacks'...for which I have had no feedback yet :-(
> 
> How should a thread complete i.e. how should it exit?
> Reading the python online docs one gets the idea that simply returning is
> OK - but I'm not sure.
> Is it ok to do a sys.ext()? Use 'return' or just let them run out with no
> 'return' ???
> 
> thanks.



More information about the Python-list mailing list