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

Method close

Lib/asyncio/base_events.py:734–755  ·  view source on GitHub ↗

Close the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running.

(self)

Source from the content-addressed store, hash-verified

732 self._stopping = True
733
734 def close(self):
735 """Close the event loop.
736
737 This clears the queues and shuts down the executor,
738 but does not wait for the executor to finish.
739
740 The event loop must not be running.
741 """
742 if self.is_running():
743 raise RuntimeError("Cannot close a running event loop")
744 if self._closed:
745 return
746 if self._debug:
747 logger.debug("Close %r", self)
748 self._closed = True
749 self._ready.clear()
750 self._scheduled.clear()
751 self._executor_shutdown_called = True
752 executor = self._default_executor
753 if executor is not None:
754 self._default_executor = None
755 executor.shutdown(wait=False)
756
757 def is_closed(self):
758 """Returns True if the event loop was closed."""

Callers 2

__del__Method · 0.95
check_in_threadMethod · 0.95

Calls 4

is_runningMethod · 0.95
debugMethod · 0.45
clearMethod · 0.45
shutdownMethod · 0.45

Tested by 1

check_in_threadMethod · 0.76