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

Class Lock

Lib/multiprocessing/synchronize.py:173–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171#
172
173class Lock(SemLock):
174
175 def __init__(self, *, ctx):
176 SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
177
178 def __repr__(self):
179 try:
180 if self._semlock._is_mine():
181 name = process.current_process().name
182 if threading.current_thread().name != 'MainThread':
183 name += '|' + threading.current_thread().name
184 elif not self._semlock._is_zero():
185 name = 'None'
186 elif self._semlock._count() > 0:
187 name = 'SomeOtherThread'
188 else:
189 name = 'SomeOtherProcess'
190 except Exception:
191 name = 'unknown'
192 return '<%s(owner=%s)>' % (self.__class__.__name__, name)
193
194#
195# Recursive lock

Callers 1

LockMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…