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

Method close

Lib/asyncio/proactor_events.py:684–702  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

682 sock, protocol, waiter, extra)
683
684 def close(self):
685 if self.is_running():
686 raise RuntimeError("Cannot close a running event loop")
687 if self.is_closed():
688 return
689
690 if threading.current_thread() is threading.main_thread():
691 signal.set_wakeup_fd(-1)
692 # Call these methods before closing the event loop (before calling
693 # BaseEventLoop.close), because they can schedule callbacks with
694 # call_soon(), which is forbidden when the event loop is closed.
695 self._stop_accept_futures()
696 self._close_self_pipe()
697 self._proactor.close()
698 self._proactor = None
699 self._selector = None
700
701 # Close the event loop
702 super().close()
703
704 async def sock_recv(self, sock, n):
705 return await self._proactor.recv(sock, n)

Callers 9

test_ctorMethod · 0.95
__del__Method · 0.45
_call_connection_lostMethod · 0.45
_eof_receivedMethod · 0.45
write_eofMethod · 0.45
_pipe_closedMethod · 0.45
_close_self_pipeMethod · 0.45
loopMethod · 0.45
_stop_servingMethod · 0.45

Calls 6

_stop_accept_futuresMethod · 0.95
_close_self_pipeMethod · 0.95
superClass · 0.85
set_wakeup_fdMethod · 0.80
is_runningMethod · 0.45
is_closedMethod · 0.45

Tested by 1

test_ctorMethod · 0.76