[Tutor] Waiting until a thread ends
lists at justuber.com
Sun Mar 20 00:36:54 CET 2011
>> In my continuing quest the find the best way of doing this I came across
>> the following method:
>> for thread in threading.enumerate():
>> if thread is not threading.currentThread():
>> print 'FINISHED'
>> In my newbie understanding, you can't join() the current thread, because
>> it's the main thread (the one from which the others are called), join()ing
>> it would lock the program up (it would never complete).
>> The above only join()s a thread if it isn't the current thread, thus
>> (hopefully) getting around this. Swapping my earlier stupid code for this
>> seems to work as expected in my tests.
> Thanks for the postbacks, it's been useful/interesting for me.
I'm really pleased that it was of some help to somebody else too.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor