Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7978
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.le-studio75.com!news.univ-fcomte.fr!not-for-mail |
|---|---|
| From | Laurent Claessens <moky.math@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: threading : make stop the caller |
| Date | Sun, 19 Jun 2011 18:08:23 +0200 |
| Organization | A poorly-installed InterNetNews site |
| Lines | 19 |
| Message-ID | <4DFE1EF7.10909@gmail.com> (permalink) |
| References | <itl1sc$ap0$1@news.univ-fcomte.fr> <mailman.155.1308496777.1164.python-list@python.org> <itl56g$aut$1@news.univ-fcomte.fr> <mailman.158.1308499394.1164.python-list@python.org> |
| NNTP-Posting-Host | soleil.univ-fcomte.fr |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.univ-fcomte.fr 1308499697 11351 194.57.84.1 (19 Jun 2011 16:08:17 GMT) |
| X-Complaints-To | news@news.univ-fcomte.fr |
| NNTP-Posting-Date | Sun, 19 Jun 2011 16:08:17 +0000 (UTC) |
| Cc | python-list@python.org |
| To | Chris Angelico <rosuav@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
| In-Reply-To | <mailman.158.1308499394.1164.python-list@python.org> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7978 |
Show key headers only | View raw
Le 19/06/2011 18:03, Chris Angelico a écrit : > On Mon, Jun 20, 2011 at 1:39 AM, Laurent Claessens<moky.math@gmail.com> wrote: >> My problem is that when FileToCopyTask raises an error, the program does not >> stop. >> In fact when the error is Disk Full, I want to stop the whole program >> because I know that the next task will fail too. > > If you're starting a thread for every file you're copying, you're > starting a huge number of threads that probably will just end up > fighting over the disk. To get a reasonably efficient early-abort, I'd > recommend having a fixed pool of worker threads (say, ten of them), > and have each thread (a) check if the early-abort flag is set, and > then (b) start copying the next file in queue. Once the queue's empty > or the early-abort flag is set, all ten threads will terminate when > they finish their current transfers. Yes, my example was simplified, but I do that :) Laurent
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
threading : make stop the caller Laurent Claessens <moky.math@gmail.com> - 2011-06-19 16:42 +0200
Re: threading : make stop the caller Chris Angelico <rosuav@gmail.com> - 2011-06-20 01:19 +1000
Re: threading : make stop the caller Laurent Claessens <moky.math@gmail.com> - 2011-06-19 17:39 +0200
Re: threading : make stop the caller Laurent Claessens <moky.math@gmail.com> - 2011-06-19 17:54 +0200
Re: threading : make stop the caller Chris Angelico <rosuav@gmail.com> - 2011-06-20 02:03 +1000
Re: threading : make stop the caller Laurent Claessens <moky.math@gmail.com> - 2011-06-19 18:08 +0200
Re: threading : make stop the caller Terry Reedy <tjreedy@udel.edu> - 2011-06-19 12:38 -0400
Re: threading : make stop the caller Laurent Claessens <moky.math@gmail.com> - 2011-06-19 18:52 +0200
Re: threading : make stop the caller Lie Ryan <lie.1296@gmail.com> - 2011-06-20 03:04 +1000
Re: threading : make stop the caller Terry Reedy <tjreedy@udel.edu> - 2011-06-19 12:58 -0400
csiph-web