MCPcopy Index your code
hub / github.com/python/cpython / shutdown_default_executor

Method shutdown_default_executor

Lib/asyncio/base_events.py:600–622  ·  view source on GitHub ↗

Schedule the shutdown of the default executor. The timeout parameter specifies the amount of time the executor will be given to finish joining. The default value is None, which means that the executor will be given an unlimited amount of time.

(self, timeout=None)

Source from the content-addressed store, hash-verified

598 })
599
600 async def shutdown_default_executor(self, timeout=None):
601 """Schedule the shutdown of the default executor.
602
603 The timeout parameter specifies the amount of time the executor will
604 be given to finish joining. The default value is None, which means
605 that the executor will be given an unlimited amount of time.
606 """
607 self._executor_shutdown_called = True
608 if self._default_executor is None:
609 return
610 future = self.create_future()
611 thread = threading.Thread(target=self._do_shutdown, args=(future,))
612 thread.start()
613 try:
614 async with timeouts.timeout(timeout):
615 await future
616 except TimeoutError:
617 warnings.warn("The executor did not finishing joining "
618 f"its threads within {timeout} seconds.",
619 RuntimeWarning, stacklevel=2)
620 self._default_executor.shutdown(wait=False)
621 else:
622 thread.join()
623
624 def _do_shutdown(self, future):
625 try:

Callers

nothing calls this directly

Calls 6

create_futureMethod · 0.95
startMethod · 0.95
joinMethod · 0.95
timeoutMethod · 0.45
warnMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected