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

Class Lock

Lib/multiprocessing/synchronize.py:166–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

LockMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected