threading : make stop the caller
Laurent Claessens
moky.math at gmail.com
Sun Jun 19 10:42:25 EDT 2011
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)
Now I want, in some circumstance to raise errors that make the loop stop.
In order IOError to make stop the loop, I tried this :
no_error = True
while task_list and no_error:
task = task_list[0]
try :
task.run()
except IOError :
no_error = False
task_list.remove(task)
But it does not work (I think the exception is raised too late).
I prefer that the taske are not aware to be included in a loop, but I
can make them raise personnal exceptions.
How can I do ?
Thanks
Laurent
More information about the Python-list
mailing list