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

Method __init__

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

RLockFunction · 0.70

Tested by

no test coverage detected