threading : make stop the caller

Laurent Claessens moky.math at gmail.com
Sun Jun 19 12:52:55 EDT 2011


> 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 (which also has 
to be closed).

Finally, I solved the problem by using a global flag looked at each 
iteration of the loop. A break is done if the global flag reports an error.

That was suggested by Alain Ketterlin from the French speaking python's 
usenet and Chris Angelico here.

Thanks all
Laurent



More information about the Python-list mailing list