[Python-checkins] cpython (2.7): Issue #17208: add a note about the termination behaviour of daemon threads.

antoine.pitrou python-checkins at python.org
Fri Feb 15 21:30:39 CET 2013


http://hg.python.org/cpython/rev/e63c4bc81d9f
changeset:   82211:e63c4bc81d9f
branch:      2.7
parent:      82202:82db097cd2e0
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Feb 15 21:27:18 2013 +0100
summary:
  Issue #17208: add a note about the termination behaviour of daemon threads.

files:
  Doc/library/threading.rst |  6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -247,6 +247,12 @@
 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list