sleep and Timer

Peter Hansen peter at engcorp.com
Thu May 29 07:49:03 EDT 2003


Rob Hall wrote:
> 
> If I alter it to do a join() on each thread before going on to kill the next
> thread, it takes over 300 seconds - clearly unacceptable.

Definitely, when killing a large batch of threads, it's much much
better to iterate over them and issue the "kill" (i.e. the "please
be so good as to commit suicide" request), and only then iterate
over the list again and join() each one.  That gives the snappier
ones time to kill themselves while you are telling others to die,
so it's faster than the serialized approach.

-Peter




More information about the Python-list mailing list