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


Groups > comp.lang.python > #96849

Re: Shutting down a cross-platform multithreaded app

From "James Harris" <james.harris.1@gmail.com>
Newsgroups comp.lang.python
Subject Re: Shutting down a cross-platform multithreaded app
Date 2015-09-19 10:56 +0100
Organization A noiseless patient Spider
Message-ID <mtjbdb$shg$1@dont-email.me> (permalink)
References <mthgrk$uh1$1@dont-email.me> <87zj0jd1ta.fsf@jester.gateway.sonic.net> <mthndd$qah$1@dont-email.me> <mailman.5.1442609448.21674.python-list@python.org>

Show all headers | View raw


"Laura Creighton" <lac@openend.se> wrote in message 
news:mailman.5.1442609448.21674.python-list@python.org...
> In a message of Fri, 18 Sep 2015 20:09:19 +0100, "James Harris" 
> writes:
>>> Set the daemon flag on the worker threads, so when the main thread
>>> exits, the workers also exit.
>>
>>Interesting idea, and I did not know that a *thread* could be a 
>>daemon.
>>Unfortunately, I think what you suggest would kill the threads stone
>>dead and not allow them to close connections.
>
> Can you stick your worker threads into a Queue.  When the main thread 
> exits
> have it tell the queue to clean itself up?
>
> see:
> http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/
>
> The main thread doesn't have to be a gui ...
>
> (but the author of that recipe and I are now drunkly celebrating a 
> birthday
> so maybe I ought not to be posting this idea ...)

:-)

I am not sure. The polling every 100ms or similar in periodicCall() is 
something I want to avoid. I think I have a way to do this without any 
polling.

James

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


Thread

Shutting down a cross-platform multithreaded app "James Harris" <james.harris.1@gmail.com> - 2015-09-18 18:17 +0100
  Re: Shutting down a cross-platform multithreaded app Paul Rubin <no.email@nospam.invalid> - 2015-09-18 11:23 -0700
    Re: Shutting down a cross-platform multithreaded app "James Harris" <james.harris.1@gmail.com> - 2015-09-18 20:09 +0100
      Re: Shutting down a cross-platform multithreaded app Laura Creighton <lac@openend.se> - 2015-09-18 22:50 +0200
        Re: Shutting down a cross-platform multithreaded app "James Harris" <james.harris.1@gmail.com> - 2015-09-19 10:56 +0100
  Re: Shutting down a cross-platform multithreaded app Marko Rauhamaa <marko@pacujo.net> - 2015-09-18 23:40 +0300
  Re: Shutting down a cross-platform multithreaded app Chris Angelico <rosuav@gmail.com> - 2015-09-19 07:40 +1000
    Re: Shutting down a cross-platform multithreaded app "James Harris" <james.harris.1@gmail.com> - 2015-09-19 10:49 +0100
      Re: Shutting down a cross-platform multithreaded app Chris Angelico <rosuav@gmail.com> - 2015-09-19 20:14 +1000
        Re: Shutting down a cross-platform multithreaded app "James Harris" <james.harris.1@gmail.com> - 2015-09-19 11:48 +0100
          Re: Shutting down a cross-platform multithreaded app Chris Angelico <rosuav@gmail.com> - 2015-09-19 20:59 +1000
  Re: Shutting down a cross-platform multithreaded app Random832 <random832@fastmail.com> - 2015-09-18 17:48 -0400
  Re: Shutting down a cross-platform multithreaded app Chris Angelico <rosuav@gmail.com> - 2015-09-19 08:09 +1000
  Re: Shutting down a cross-platform multithreaded app Akira Li <4kir4.1i@gmail.com> - 2015-09-19 02:56 +0300

csiph-web