Question about thread

Jarek Zgoda jzgoda at gazeta.usun.pl
Fri Nov 19 16:33:47 EST 2004


Diez B. Roggisch wrote:

>>Even after printing "finished creating threads" all spawned threads
>>continue its execution up to final "thread nnnn is being destroyed", so
>>I think there's no need to take any special action (unless it's Python
>>on iSeries, buy this is another story) to wait for completion.
> 
> The OP used the module "thread", while you used "threading" and didn't set
> setDaemon(False). Then python waits until all threads are finished.

Well... I was bit too fast in replying. ;)

> From the thread module docs:
> 
> When the main thread exits, it is system defined whether the other threads
> survive. On SGI IRIX using the native thread implementation, they survive.
> On most other systems, they are killed without executing try ... finally
> clauses or executing object destructors.   

So it looks that using threading should be preferred over using thread, 
as presented example works identically on Windows and on linux (it 
doesn't work on AS/400, though...).

-- 
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/



More information about the Python-list mailing list