MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _stop

Method _stop

tools/python-3.11.9-amd64/Lib/threading.py:1051–1076  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1049 self._delete()
1050
1051 def _stop(self):
1052 # After calling ._stop(), .is_alive() returns False and .join() returns
1053 # immediately. ._tstate_lock must be released before calling ._stop().
1054 #
1055 # Normal case: C code at the end of the thread's life
1056 # (release_sentinel in _threadmodule.c) releases ._tstate_lock, and
1057 # that's detected by our ._wait_for_tstate_lock(), called by .join()
1058 # and .is_alive(). Any number of threads _may_ call ._stop()
1059 # simultaneously (for example, if multiple threads are blocked in
1060 # .join() calls), and they're not serialized. That's harmless -
1061 # they'll just make redundant rebindings of ._is_stopped and
1062 # ._tstate_lock. Obscure: we rebind ._tstate_lock last so that the
1063 # "assert self._is_stopped" in ._wait_for_tstate_lock() always works
1064 # (the assert is executed only if ._tstate_lock is None).
1065 #
1066 # Special case: _main_thread releases ._tstate_lock via this
1067 # module's _shutdown() function.
1068 lock = self._tstate_lock
1069 if lock is not None:
1070 assert not lock.locked()
1071 self._is_stopped = True
1072 self._tstate_lock = None
1073 if not self.daemon:
1074 with _shutdown_locks_lock:
1075 # Remove our lock and other released locks from _shutdown_locks
1076 _maintain_shutdown_locks()
1077
1078 def _delete(self):
1079 "Remove current thread from the dict of currently running threads."

Callers 3

_wait_for_tstate_lockMethod · 0.95
_shutdownFunction · 0.45
_after_forkFunction · 0.45

Calls 2

_maintain_shutdown_locksFunction · 0.85
lockedMethod · 0.45

Tested by

no test coverage detected