Commit db1d7087 authored by Antoine Pitrou's avatar Antoine Pitrou

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

parent 1a20aa92
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment