gaoxinge <gao...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue40093>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to