Anonymous committed 8b85f10 Merge

Issue #17208: add a note about the termination behaviour of daemon threads.

  • Participants
  • Parent commits 46e9f66, 917ae89

Comments (0)

Files changed (1)

File Doc/library/threading.rst

 through the :attr:`~Thread.daemon` property or the *daemon* constructor
+.. 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.