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


Groups > comp.lang.python > #96835

Re: Shutting down a cross-platform multithreaded app

Path csiph.com!eternal-september.org!feeder.eternal-september.org!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <lac@openend.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'exit.': 0.09; 'exits': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:skip:m 10': 0.09; 'threads,': 0.09; 'thread': 0.10; 'suggest': 0.15; '(but': 0.15; '...)': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'recipe': 0.16; 'threads': 0.16; 'laura': 0.18; 'stick': 0.18; 'gui': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'see:': 0.22; 'sep': 0.22; "doesn't": 0.26; 'fri,': 0.27; 'idea': 0.28; 'idea,': 0.29; 'queue': 0.29; 'received:se': 0.29; 'url:activestate': 0.29; 'cc:no real name:2**1': 0.29; 'posting': 0.32; 'maybe': 0.33; 'url:code': 0.34; 'could': 0.35; 'skip:> 10': 0.35; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'itself': 0.38; 'subject:-': 0.39; 'your': 0.60; 'close': 0.61; 'header :Message-Id:1': 0.61; 'header:In-reply-to:1': 0.84; 'stone': 0.84; 'subject:down': 0.84; 'url:recipes': 0.84; 'birthday': 0.91
To "James Harris" <james.harris.1@gmail.com>
cc python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: Shutting down a cross-platform multithreaded app
In-reply-to <mthndd$qah$1@dont-email.me>
References <mthgrk$uh1$1@dont-email.me> <87zj0jd1ta.fsf@jester.gateway.sonic.net> <mthndd$qah$1@dont-email.me>
Comments In-reply-to "James Harris" <james.harris.1@gmail.com> message dated "Fri, 18 Sep 2015 20:09:19 +0100."
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <8280.1442609436.1@fido>
Date Fri, 18 Sep 2015 22:50:36 +0200
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Fri, 18 Sep 2015 22:50:39 +0200 (CEST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5.1442609448.21674.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442609448 news.xs4all.nl 23757 [2001:888:2000:d::a6]:33048
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96835

Show key headers only | View raw


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 ...)

Laura

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