summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-02-15 20:32:30 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-02-15 20:32:30 (GMT)
commita7b814973f8a3bae62aaec5cde358f175190994d (patch)
treef8049363ff6e6db48c745b80c9ea10e045dbb7b6
parent10f89329adac0a405b5416727c0df6bd4ba6a17d (diff)
parentdb0b7be566f9442f8d09548b4ae1e4d475e09fc0 (diff)
downloadcpython-a7b814973f8a3bae62aaec5cde358f175190994d.zip
cpython-a7b814973f8a3bae62aaec5cde358f175190994d.tar.gz
cpython-a7b814973f8a3bae62aaec5cde358f175190994d.tar.bz2
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 ec23504..00ae3ec 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -174,6 +174,12 @@ initial value is inherited from the creating thread. The flag can be set
through the :attr:`~Thread.daemon` property or the *daemon* constructor
argument.
+.. 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.