Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7970
| References | <itl1sc$ap0$1@news.univ-fcomte.fr> |
|---|---|
| Date | 2011-06-20 01:19 +1000 |
| Subject | Re: threading : make stop the caller |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.155.1308496777.1164.python-list@python.org> (permalink) |
On Mon, Jun 20, 2011 at 12:42 AM, Laurent Claessens <moky.math@gmail.com> wrote: > Hello > > > I've a list of tasks to perform. Each of them is a threading.Thread. > Basically I have : > > while task_list : > task = task_list[0] > task.run() > task_list.remove(task) I'm not understanding what you're doing with threads here. Are you using threading.Thread but then calling its run() method synchronously? Normally threads are used for asynchronous operations. You would then use the start() method to spin the thread off; it will return almost immediately, and the thread will run to completion in parallel with you. But then you can't halt the main loop, because it will have already finished by the time you detect the IOError (starting a bunch of threads is pretty quick). On the other hand, the code you're showing seems to simply call each thread's run() method one by one, which should propagate any exceptions in the same way that function calls usually do. Can you share the code for one of the tasks, and show what happens when it raises an exception? Chris Angelico
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