how to drop all thread ??

Peter Hansen peter at engcorp.com
Mon Nov 29 16:33:40 CET 2004


Diez B. Roggisch wrote:
> Leon wrote:
> 
> 
>>if class A(
>>use threading,thread module
>>) to produce 100 thread,how to drop its (100 thread) when its running
> 
> 
> By exiting. There is no other way to stop a thread by force. 

Note that even trying to exit won't work, if the threads are not
marked as "daemon" threads...  Only by calling .setDaemon(True) on
the threads before they are started will you be able to terminate
them all just by exiting.

-Peter



More information about the Python-list mailing list