(original) (raw)
changeset: 82212:8753a3be4a3c branch: 3.2 parent: 82203:efe489f87881 user: Antoine Pitrou solipsis@pitrou.net date: Fri Feb 15 21:27:18 2013 +0100 files: Doc/library/threading.rst description: Issue #17208: add a note about the termination behaviour of daemon threads. diff -r efe489f87881 -r 8753a3be4a3c Doc/library/threading.rst --- a/Doc/library/threading.rst Wed Feb 13 15:19:36 2013 +0000 +++ b/Doc/library/threading.rst Fri Feb 15 21:27:18 2013 +0100 @@ -244,6 +244,12 @@ 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. /solipsis@pitrou.net