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

Method __init__

Lib/threading.py:290–307  ·  view source on GitHub ↗
(self, lock=None)

Source from the content-addressed store, hash-verified

288 """
289
290 def __init__(self, lock=None):
291 if lock is None:
292 lock = RLock()
293 self._lock = lock
294 # Export the lock's acquire(), release(), and locked() methods
295 self.acquire = lock.acquire
296 self.release = lock.release
297 self.locked = lock.locked
298 # If the lock defines _release_save() and/or _acquire_restore(),
299 # these override the default implementations (which just call
300 # release() and acquire() on the lock). Ditto for _is_owned().
301 if hasattr(lock, '_release_save'):
302 self._release_save = lock._release_save
303 if hasattr(lock, '_acquire_restore'):
304 self._acquire_restore = lock._acquire_restore
305 if hasattr(lock, '_is_owned'):
306 self._is_owned = lock._is_owned
307 self._waiters = _deque()
308
309 def _at_fork_reinit(self):
310 self._lock._at_fork_reinit()

Callers

nothing calls this directly

Calls 2

hasattrFunction · 0.85
RLockFunction · 0.70

Tested by

no test coverage detected