Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7978
| From | Laurent Claessens <moky.math@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: threading : make stop the caller |
| Date | 2011-06-19 18:08 +0200 |
| Organization | A poorly-installed InterNetNews site |
| 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> |
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