summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/atexit.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst
index a2bd85b..3dbef69 100644
--- a/Doc/library/atexit.rst
+++ b/Doc/library/atexit.rst
@@ -48,6 +48,16 @@ a cleanup function is undefined.
This function returns *func*, which makes it possible to use it as a
decorator.
+ .. warning::
+ Starting new threads or calling :func:`os.fork` from a registered
+ function can lead to race condition between the main Python
+ runtime thread freeing thread states while internal :mod:`threading`
+ routines or the new process try to use that state. This can lead to
+ crashes rather than clean shutdown.
+
+ .. versionchanged:: 3.12
+ Attempts to start a new thread or :func:`os.fork` a new process
+ in a registered function now leads to :exc:`RuntimeError`.
.. function:: unregister(func)