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


Groups > comp.lang.python > #72321

Re: daemon thread cleanup approach

Date 2014-05-30 13:59 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: daemon thread cleanup approach
References <368aec88-ebe9-4da0-a537-92ff9b690647@googlegroups.com> <CABicbJ+Ypf12Ka_exf8OyjB61fc95gpB9J=c2g5SP9sQtihctg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.10499.1401486404.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 05/30/2014 01:47 PM, Devin Jeanpierre wrote:
>
> Don't use daemon threads, they are inherently un-thread-safe: any
> global access you do anywhere inside a daemon thread can fail, because
> daemon threads are still potentially run during interpreter shutdown,
> when globals are being deleted from every module. Most functions you
> might call are not safe in a daemon thread at shutdown.

Given the use-case (must shut down, cannot risk a hung process, orphan files be damned) I don't think having a daemon 
thread die because it raised an exception trying to access a missing global is a big deal.

--
~Ethan~

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


Thread

daemon thread cleanup approach Carl Banks <pavlovevidence@gmail.com> - 2014-05-28 18:20 -0700
  Re: daemon thread cleanup approach Miki Tebeka <miki.tebeka@gmail.com> - 2014-05-28 22:51 -0700
  Re: daemon thread cleanup approach Cameron Simpson <cs@zip.com.au> - 2014-05-29 16:07 +1000
  Re: daemon thread cleanup approach Chris Angelico <rosuav@gmail.com> - 2014-05-29 18:15 +1000
    Re: daemon thread cleanup approach Carl Banks <pavlovevidence@gmail.com> - 2014-05-29 12:40 -0700
  Re: daemon thread cleanup approach Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-05-30 13:47 -0700
  Re: daemon thread cleanup approach Ethan Furman <ethan@stoneleaf.us> - 2014-05-30 13:59 -0700
  Re: daemon thread cleanup approach Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-05-30 14:58 -0700

csiph-web