Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50031
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.061 |
| X-Spam-Evidence | '*H*': 0.88; '*S*': 0.00; 'subject:How': 0.10; 'blocks': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'simpson': 0.16; 'subject:threads': 0.16; 'threads,': 0.16; 'wrote:': 0.18; 'manual': 0.22; 'header :User-Agent:1': 0.23; 'driver': 0.24; 'cheers,': 0.24; 'this:': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; "d'aprano": 0.31; 'steven': 0.31; 'device': 0.34; 'created': 0.35; 'charset :us-ascii': 0.36; 'subject:?': 0.36; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'content-disposition:inline': 0.62; 'received:121': 0.68; 'received:61': 0.74; 'done:': 0.84; 'ncr': 0.84; 'subject:being': 0.84; 'subject:check': 0.84 |
| X-Authority-Analysis | v=2.0 cv=IccFqBWa c=1 sm=1 a=vybC443edK8SvCmZ09ZPTw==:17 a=wom5GMh1gUkA:10 a=ocHKTuOYpwYA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=ykJ_WEBzZ4MA:10 a=kZ7UWmmPAAAA:8 a=cCc2-fivUlAK0qARKtMA:9 a=CjuIK1q_8ugA:10 a=pyH5b1fOeEsA:10 a=vybC443edK8SvCmZ09ZPTw==:117 |
| Date | Sat, 6 Jul 2013 10:45:13 +1000 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | python-list@python.org |
| Subject | Re: How to check for threads being finished? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <51d6fb8a$0$29999$c3e8da3$5496439d@news.astraweb.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <51d6fb8a$0$29999$c3e8da3$5496439d@news.astraweb.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4317.1373071518.3114.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1373071518 news.xs4all.nl 15911 [2001:888:2000:d::a6]:33217 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50031 |
Show key headers only | View raw
On 05Jul2013 16:59, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
| I have a pool of worker threads, created like this:
|
| threads = [MyThread(*args) for i in range(numthreads)]
| for t in threads:
| t.start()
|
| I then block until the threads are all done:
|
| while any(t.isAlive() for t in threads):
| pass
This spins.
How about:
for t in threads:
t.join()
Blocks instead of polls.
Cheers,
--
Cameron Simpson <cs@zip.com.au>
Processes are like potatoes. - NCR device driver manual
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
How to check for threads being finished? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-05 16:59 +0000
Re: How to check for threads being finished? Chris Angelico <rosuav@gmail.com> - 2013-07-06 03:11 +1000
Re: How to check for threads being finished? Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-07-05 19:12 +0200
Re: How to check for threads being finished? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-06 02:18 +0000
Re: How to check for threads being finished? Stefan Behnel <stefan_ml@behnel.de> - 2013-07-06 10:49 +0200
Re: How to check for threads being finished? Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-05 11:18 -0600
Re: How to check for threads being finished? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-07-05 16:13 -0400
Re: How to check for threads being finished? Cameron Simpson <cs@zip.com.au> - 2013-07-06 10:45 +1000
csiph-web