Thread terminate

Skip Montanaro skip at pobox.com
Thu Aug 28 09:51:09 EDT 2014


On Wed, Aug 27, 2014 at 1:55 PM, Ervin Hegedüs <airween at gmail.com> wrote:

> what's the correct way to terminate a thread by itself?


If this is something you need to do as a regular course of business, I'd
share a Queue between the main thread and the target thread. When you want
it to exit, shoot it a command to do so over the queue. If it's a worker
thread of some sort, set it as a daemon thread. When your main thread exits
and there are no other non-daemon threads alive, the program will exit.

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140828/b75998b6/attachment.html>


More information about the Python-list mailing list