MCPcopy Index your code
hub / github.com/RustPython/RustPython / start

Method start

Lib/threading.py:975–1011  ·  view source on GitHub ↗

Start the thread's activity. It must be called at most once per thread object. It arranges for the object's run() method to be invoked in a separate thread of control. This method will raise a RuntimeError if called more than once on the same thread object.

(self)

Source from the content-addressed store, hash-verified

973 return "<%s(%s, %s)>" % (self.__class__.__name__, self._name, status)
974
975 def start(self):
976 """Start the thread&#x27;s activity.
977
978 It must be called at most once per thread object. It arranges for the
979 object&#x27;s run() method to be invoked in a separate thread of control.
980
981 This method will raise a RuntimeError if called more than once on the
982 same thread object.
983
984 """
985 if not self._initialized:
986 raise RuntimeError("thread.__init__() not called")
987
988 if self._started.is_set():
989 raise RuntimeError("threads can only be started once")
990
991 with _active_limbo_lock:
992 _limbo[self] = self
993
994 if self._context is None:
995 # No context provided
996 if _sys.flags.thread_inherit_context:
997 # start with a copy of the context of the caller
998 self._context = _contextvars.copy_context()
999 else:
1000 # start with an empty context
1001 self._context = _contextvars.Context()
1002
1003 try:
1004 # Start joinable thread
1005 _start_joinable_thread(self._bootstrap, handle=self._os_thread_handle,
1006 daemon=self.daemon)
1007 except Exception:
1008 with _active_limbo_lock:
1009 del _limbo[self]
1010 raise
1011 self._started.wait() # Will set ident and native_id
1012
1013 def run(self):
1014 """Method representing the thread&#x27;s activity.

Callers 15

process_requestMethod · 0.95
add_child_handlerMethod · 0.95
startMethod · 0.95
queue_join_testMethod · 0.95
test_threaded_pollMethod · 0.95
test_current_framesMethod · 0.95

Calls 2

is_setMethod · 0.45
waitMethod · 0.45