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

Method _check_thread

Lib/asyncio/base_events.py:858–873  ·  view source on GitHub ↗

Check that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is respon

(self)

Source from the content-addressed store, hash-verified

856 return handle
857
858 def _check_thread(self):
859 """Check that the current thread is the thread running the event loop.
860
861 Non-thread-safe methods of this class make this assumption and will
862 likely behave incorrectly when the assumption is violated.
863
864 Should only be called when (self._debug == True). The caller is
865 responsible for checking this condition for performance reasons.
866 """
867 if self._thread_id is None:
868 return
869 thread_id = threading.get_ident()
870 if thread_id != self._thread_id:
871 raise RuntimeError(
872 "Non-thread-safe operation invoked on an event loop other "
873 "than the current one")
874
875 def call_soon_threadsafe(self, callback, *args, context=None):
876 """Like call_soon(), but thread-safe."""

Callers 2

call_atMethod · 0.95
call_soonMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected