Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77208

Re: Thread terminate

References <20140827185514.GA18660@arxnet.hu>
Date 2014-08-28 08:51 -0500
Subject Re: Thread terminate
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.13559.1409233872.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Aug 27, 2014 at 1:55 PM, Ervin Hegedüs <airween@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Thread terminate Skip Montanaro <skip@pobox.com> - 2014-08-28 08:51 -0500

csiph-web