]> granicus.if.org Git - python/commitdiff
Issue #17208: add a note about the termination behaviour of daemon threads.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 15 Feb 2013 20:27:18 +0000 (21:27 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 15 Feb 2013 20:27:18 +0000 (21:27 +0100)
Doc/library/threading.rst

index dee765aa40fd391f147fd69a4a967791d490c64c..1f4b5a6fee56780ba1cb5df7d37be5f93cf8edce 100644 (file)
@@ -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.