[issue40093] ThreadPoolExecutor with wait=True shuts down too early
gaoxinge
report at bugs.python.org
Sun Mar 29 11:18:22 EDT 2020
gaoxinge <gaoxx5 at gmail.com> added the comment:
```
from concurrent.futures import ThreadPoolExecutor
from time import sleep
def wait_on_future():
sleep(1)
print(f.done()) # f is not done obviously
f2 = executor.submit(pow, 5, 2)
print(f2.result())
sleep(1)
executor = ThreadPoolExecutor(max_workers=100)
f = executor.submit(wait_on_future)
executor.shutdown(wait=True)
print(f.done()) # True
print(f.result()) # raise errror: cannot schedule new futures after shutdown
# print(f.exception())
```
Actually `executor.shutdown(wait=True)` works, it really wait f to be done.
----------
nosy: +gaoxinge
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40093>
_______________________________________
More information about the Python-bugs-list
mailing list