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.
This commit is contained in:
Shantanu 2020-09-01 14:18:07 -07:00 committed by GitHub
parent 9b648a95cc
commit 17dc1b789e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -605,7 +605,7 @@ class Executor(object):
future.cancel() future.cancel()
return result_iterator() return result_iterator()
def shutdown(self, wait=True): def shutdown(self, wait=True, *, cancel_futures=False):
"""Clean-up the resources associated with the Executor. """Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other 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 wait: If True then shutdown will not return until all running
futures have finished executing and the resources used by the futures have finished executing and the resources used by the
executor have been reclaimed. 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 pass