safest way to kill a thread

limodou limodou at
Tue Jan 18 23:31:11 EST 2005

Using Thread's method setDaemon() before you call the start() method. 
Just like :


martinnitram at wrote:
> Dear all,
> in python, a thread can be created by t = threading.Thread. But i
> found that when the main (and the thread) program is running and user
> use Crtl+C/Crtl+Z to break the program abnormally, the thread is still
> running and needed to kill manually (by the pid). Is there had any
> safest way to kill/exit the thread program under python (when the
> thread program part is a forever loop)?
>     Thank a lot

I love python!
My Blog:

More information about the Python-list mailing list