Re: threading : make stop the caller

2011-06-19 Thread Lie Ryan
On 06/20/11 02:52, Laurent Claessens wrote: > >> Popping task off the end of the list is more efficient: > >> while task_list: >> task_list.pop().start() > > That's cool. In my case it's better to do > task_list.pop(0).start > > in order to pop the first element. then you really wanted a q

Re: threading : make stop the caller

2011-06-19 Thread Terry Reedy
On 6/19/2011 12:03 PM, Chris Angelico wrote: On Mon, Jun 20, 2011 at 1:39 AM, Laurent Claessens 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

Re: threading : make stop the caller

2011-06-19 Thread Laurent Claessens
Popping task off the end of the list is more efficient: while task_list: task_list.pop().start() That's cool. In my case it's better to do task_list.pop(0).start in order to pop the first element. or if the list is static No, my list is dynamic and is feeded by an other thread (whi

Re: threading : make stop the caller

2011-06-19 Thread Laurent Claessens
Le 19/06/2011 18:03, Chris Angelico a écrit : On Mon, Jun 20, 2011 at 1:39 AM, Laurent Claessens 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

Re: threading : make stop the caller

2011-06-19 Thread Terry Reedy
On 6/19/2011 11:39 AM, Laurent Claessens wrote: In the same time I've a thread that read the list and perform the operations: def run(): while task_list : task = task_list[0] task_list.remove(task) task.start() Popping task off the end of the list is more efficient: while task_list: task_l

Re: threading : make stop the caller

2011-06-19 Thread Chris Angelico
On Mon, Jun 20, 2011 at 1:39 AM, Laurent Claessens 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 f

Re: threading : make stop the caller

2011-06-19 Thread Laurent Claessens
I read the library documentation. I think that if I get a trick to kill a thread, then I'm done. Is there a way ? Laurent Le 19/06/2011 17:39, Laurent Claessens a écrit : Le 19/06/2011 17:19, Chris Angelico a écrit : On Mon, Jun 20, 2011 at 12:42 AM, Laurent Claessens wrote: Hello

Re: threading : make stop the caller

2011-06-19 Thread Laurent Claessens
Le 19/06/2011 17:19, Chris Angelico a écrit : On Mon, Jun 20, 2011 at 12:42 AM, Laurent Claessens 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)

Re: threading : make stop the caller

2011-06-19 Thread Chris Angelico
On Mon, Jun 20, 2011 at 12:42 AM, Laurent Claessens 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

threading : make stop the caller

2011-06-19 Thread Laurent Claessens
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