mirror of
https://github.com/python/cpython.git
synced 2026-01-03 22:12:27 +00:00
gh-86128: Add warning to ThreadPoolExecutor docs about atexit behaviour (GH-94008)
This commit is contained in:
parent
70068b9336
commit
7df2f4d787
2 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Document a limitation in ThreadPoolExecutor where its exit handler is executed before any handlers in atexit.
|
||||
Loading…
Add table
Add a link
Reference in a new issue