From: Antoine Pitrou Date: Fri, 15 Feb 2013 20:27:18 +0000 (+0100) Subject: Issue #17208: add a note about the termination behaviour of daemon threads. X-Git-Tag: v2.7.4rc1~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1575714fff00b3fd69fde68f2242e468ac47485;p=thirdparty%2FPython%2Fcpython.git Issue #17208: add a note about the termination behaviour of daemon threads. --- diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index dee765aa40fd..1f4b5a6fee56 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -247,6 +247,12 @@ that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set through the :attr:`daemon` property. +.. note:: + Daemon threads are abruptly stopped at shutdown. Their resources (such + as open files, database transactions, etc.) may not be released properly. + If you want your threads to stop gracefully, make them non-daemonic and + use a suitable signalling mechanism such as an :class:`Event`. + There is a "main thread" object; this corresponds to the initial thread of control in the Python program. It is not a daemon thread.