diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2020-09-01 14:18:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 17:18:07 -0400 |
commit | 17dc1b789ecc33b4a254eb3b799085f4b3624ca5 (patch) | |
tree | 6e3e027f48c81d396ac6cbc33269b707dfaba671 | |
parent | 9b648a95ccb4c3b14f1e87158f5c9f5dbb2f62c0 (diff) | |
download | cpython-git-17dc1b789ecc33b4a254eb3b799085f4b3624ca5.tar.gz |
bpo-39349: Add cancel_futures to Executor.shutdown base class (GH-22023)
* Add cancel_futures parameter to the Executor base class, since it was missed in the original PR (https://github.com/python/cpython/pull/18057) that added cancel_futures.
-rw-r--r-- | Lib/concurrent/futures/_base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py index bf546f8ae1..00eb54881f 100644 --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -605,7 +605,7 @@ class Executor(object): future.cancel() return result_iterator() - def shutdown(self, wait=True): + def shutdown(self, wait=True, *, cancel_futures=False): """Clean-up the resources associated with the Executor. It is safe to call this method several times. Otherwise, no other @@ -615,6 +615,9 @@ class Executor(object): wait: If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed. + cancel_futures: If True then shutdown will cancel all pending + futures. Futures that are completed or running will not be + cancelled. """ pass |