Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38433

Re: which situations should we use thread. join() ?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!not-for-mail
From Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Newsgroups comp.lang.python
Subject Re: which situations should we use thread. join() ?
Date Fri, 08 Feb 2013 09:27:59 +0100
Lines 25
Message-ID <fhpeu9-8ec.ln1@satorlaser.homedns.org> (permalink)
References <c8cdab0f-6b20-4b76-a494-068a03d81d97@googlegroups.com> <mailman.1487.1360304991.2939.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de IqIKcAomSj9qYGsoBtA98w2DLLW1BWouwmfMB/Vc1EAcHrgVt1+6RusObdAw==
X-Orig-Path satorlaser.homedns.org!not-for-mail
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <mailman.1487.1360304991.2939.python-list@python.org>
Xref csiph.com comp.lang.python:38433

Show key headers only | View raw


Am 08.02.2013 07:29, schrieb Chris Angelico:
> On Fri, Feb 8, 2013 at 3:32 PM, iMath <redstone-cold@163.com> wrote:
>> 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.

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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

which situations should we use thread. join() ? iMath <redstone-cold@163.com> - 2013-02-07 20:32 -0800
  Re: which situations should we use thread. join() ? Chris Angelico <rosuav@gmail.com> - 2013-02-08 17:29 +1100
    Re: which situations should we use thread. join() ? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-02-08 09:27 +0100

csiph-web