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

This commit is contained in:
[object Object] 2022-07-28 15:38:56 -07:00 committed by GitHub
parent 70068b9336
commit 7df2f4d787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1 @@
Document a limitation in ThreadPoolExecutor where its exit handler is executed before any handlers in atexit.