thread end and make main program end also?

Diez B. Roggisch deetsNOSPAM at web.de
Thu Mar 10 11:13:05 CET 2005


>      is it the default behavior of thread return? Thank a lot

No.

First of all: your code is clearly _not_ exposing the described behaviour -
you talk about exception handling, but there is none done. And you don't
say anything about what your doing in your "cont'" parts.

If code run in a thread throws an exception that is not handled, the thread
will die.

The program will terminate when the main thread terminates and all other
threads that have setDaemon(False) are terminated. If all the threads
(except main) have setDaemon(True) (as yours has), the program will end
immediately after the main thread terminated.


Read the threading modules docs.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list