summaryrefslogtreecommitdiffstats
path: root/Doc/library/threading.rst
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-02-15 20:27:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-02-15 20:27:18 (GMT)
commit38b82543f7f38d7e23586e6773e0e114d335f22d (patch)
treee0d5334eede5516b091202cdb78496cd41588d26 /Doc/library/threading.rst
parent439bdb10623fabacaadee070c58aa55b144fb084 (diff)
downloadcpython-38b82543f7f38d7e23586e6773e0e114d335f22d.zip
cpython-38b82543f7f38d7e23586e6773e0e114d335f22d.tar.gz
cpython-38b82543f7f38d7e23586e6773e0e114d335f22d.tar.bz2
Issue #17208: add a note about the termination behaviour of daemon threads.
Diffstat (limited to 'Doc/library/threading.rst')
-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 4a01211..e30f0e3 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -244,6 +244,12 @@ is 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:`~Thread.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.