mirror of
https://github.com/python/cpython.git
synced 2026-04-14 07:41:00 +00:00
[3.14] gh-141617: clarify concurrent.futures.ThreadPoolExecutor deadlock example (GH-141620) (#145686)
gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (GH-141620)
---------
(cherry picked from commit 171133aa84)
Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
778ff23689
commit
38440549db
1 changed files with 3 additions and 1 deletions
|
|
@ -156,7 +156,9 @@ And::
|
|||
print(f.result())
|
||||
|
||||
executor = ThreadPoolExecutor(max_workers=1)
|
||||
executor.submit(wait_on_future)
|
||||
future = executor.submit(wait_on_future)
|
||||
# Note: calling future.result() would also cause a deadlock because
|
||||
# the single worker thread is already waiting for wait_on_future().
|
||||
|
||||
|
||||
.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue