bpo-37137, asyncio: add BaseEventLoop.wait_executor_on_close by vstinner · Pull Request #13786 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Doc/library/asyncio-eventloop.rst
4 changes: 3 additions & 1 deletion Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ async def wait_closed(self):
class BaseEventLoop(events.AbstractEventLoop):

def __init__(self):
# If true, close() waits for the default executor to finish
self.wait_executor_on_close = True
self._timer_cancelled_count = 0
self._closed = False
self._stopping = False
Expand Down Expand Up @@ -635,7 +637,7 @@ def close(self):
executor = self._default_executor
if executor is not None:
self._default_executor = None
executor.shutdown(wait=False)
executor.shutdown(wait=self.wait_executor_on_close)

def is_closed(self):
"""Returns True if the event loop was closed."""
Expand Down