def acquire(self, blocking=True, timeout=None):
with self._reference_lock:
# You are the man, bump the ref count
if self._lock_holding_thread == _get_ident():
self._reference_count += 1
return True
lock_result = super(RLock, self).acquire(blocking, timeout)
if lock_result:
with self._reference_lock:
self._lock_holding_thread = _get_ident()
self._reference_count = 1
return lock_result
评论列表
文章目录