summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-02-15 21:27:18 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-02-15 21:27:18 +0100
commitf1575714fff00b3fd69fde68f2242e468ac47485 (patch)
treed45c5f725a4c9f84dcf4db8d796135a12134c368
parentf4b6560f7c2f338b00fd019db424962c365a0d3d (diff)
downloadcpython-git-f1575714fff00b3fd69fde68f2242e468ac47485.tar.gz
Issue #17208: add a note about the termination behaviour of daemon threads.
-rw-r--r--Doc/library/threading.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index dee765aa40..1f4b5a6fee 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.