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

Class RLock

Lib/_dummy_thread.py:277–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275
276
277class RLock:
278 def __init__(self):
279 self.locked_count = 0
280
281 def acquire(self, waitflag=None, timeout=-1):
282 self.locked_count += 1
283 return True
284
285 __enter__ = acquire
286
287 def __exit__(self, typ, val, tb):
288 self.release()
289
290 def release(self):
291 if not self.locked_count:
292 raise error
293 self.locked_count -= 1
294 return True
295
296 def locked(self):
297 return self.locked_count != 0
298
299 def __repr__(self):
300 return "<%s %s.%s object owner=%s count=%s at %s>" % (
301 "locked" if self.locked_count else "unlocked",
302 self.__class__.__module__,
303 self.__class__.__qualname__,
304 get_ident() if self.locked_count else 0,
305 self.locked_count,
306 hex(id(self)),
307 )
308
309
310class _local:

Callers 1

_lru_cache_wrapperFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected