which situations should we use thread. join() ?

C

Chris Angelico

which situations should we use thread. join() ?
http://bpaste.net/show/yBDGfrlU7BDDpvEZEHmo/
why do we not put thread. join() in this code ?

I've no idea why you don't put thread.join() in that code. Maybe
because it isn't needed, maybe because someone likes to live on the
edge, maybe it's not so much "the edge" as positively cloud cuckoo
land. When should you use it? When you want to accomplish what the
function does, the details of which can be found in the Fine Manual.
Actually, you probably know already what it does, or you wouldn't even
be asking.

ChrisA
 
U

Ulrich Eckhardt

Am 08.02.2013 07:29, schrieb Chris Angelico:
I've no idea why you don't put thread.join() in that code. Maybe
because it isn't needed, maybe because someone likes to live on the
edge, maybe it's not so much "the edge" as positively cloud cuckoo
land. When should you use it? When you want to accomplish what the
function does, the details of which can be found in the Fine Manual.
Actually, you probably know already what it does, or you wouldn't even
be asking.

It isn't needed. I personally would prefer an explicit join(), but
according to the documentation, "The entire Python program exits when no
alive non-daemon threads are left.". In other words, the initial thread
is not special and the interpreter will implicitly join() all non-daemon
threads.

Which again makes me want to find out in what thread's context the
atexit call is made...

Uli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top