Skip to content
Snippets Groups Projects
Unverified Commit 7df2f4d7 authored by [object Object]'s avatar [object Object] Committed by GitHub
Browse files

gh-86128: Add warning to ThreadPoolExecutor docs about atexit behaviour (GH-94008)

parent 70068b93
Branches
Tags
No related merge requests found
......@@ -149,6 +149,13 @@ And::
An :class:`Executor` subclass that uses a pool of at most *max_workers*
threads to execute calls asynchronously.
All threads enqueued to ``ThreadPoolExecutor`` will be joined before the
interpreter can exit. Note that the exit handler which does this is
executed *before* any exit handlers added using `atexit`. This means
exceptions in the main thread must be caught and handled in order to
signal threads to exit gracefully. For this reason, it is recommended
that ``ThreadPoolExecutor`` not be used for long-running tasks.
*initializer* is an optional callable that is called at the start of
each worker thread; *initargs* is a tuple of arguments passed to the
initializer. Should *initializer* raise an exception, all currently
......
Document a limitation in ThreadPoolExecutor where its exit handler is executed before any handlers in atexit.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment