Question about thread

Peter Otten __peter__ at web.de
Fri Nov 19 16:44:09 EST 2004


Jarek Zgoda wrote:

>> You need to cause the main thread to wait on the child threads until
>> they've all finished, otherwise - as Peter Hickman just mentioned - your
>> script will terminate and all threads will end. Ten seconds on Google
>> found this:
>> 
>> http://www.faqts.com/knowledge_base/view.phtml/aid/1364
> 
> Are you sure? I keep observing that child threads continue its execution
> until completion even if I do nothing in main thread. Consider this
> example:

You are using the real thing - the highlevel threading.Thread class - not
the underlying thread.start_new_thread() function. 
The threading module creates a _MainThread (a Thread subclass) instance that
registers itself as an atexit handler and waits for the other (non-demon)
Thread instances to terminate.

Failure-to-provide-the-source-code-will-ultimately-work-against
-companies-sitting-on-a-pile-of-crap-patents-ly yours

Peter






More information about the Python-list mailing list