b.c.CountedLock(object) : class documentation

Part of bzrlib.counted_lock View In Hierarchy

Decorator around a lock that makes it reentrant.

This can be used with any object that provides a basic Lock interface, including LockDirs and OS file locks.

Instance Variables_tokenWhile a write lock is held, this is the token for it.
Method __init__ Undocumented
Method __repr__ Undocumented
Method break_lock Undocumented
Method get_physical_lock_status Return physical lock status.
Method is_locked Undocumented
Method lock_read Acquire the lock in read mode.
Method lock_write Acquire the lock in write mode.
Method unlock Undocumented
def __init__(self, real_lock):
def __repr__(self):
def break_lock(self):
def get_physical_lock_status(self):
Return physical lock status.

Returns true if a lock is held on the transport. If no lock is held, or the underlying locking mechanism does not support querying lock status, false is returned.

def is_locked(self):
def lock_read(self):
Acquire the lock in read mode.

If the lock is already held in either read or write mode this increments the count and succeeds. If the lock is not already held, it is taken in read mode.

def lock_write(self, token=None):
Acquire the lock in write mode.

If the lock was originally acquired in read mode this will fail.

ParameterstokenIf given and the lock is already held, then validate that we already hold the real lock with this token.
ReturnsThe token from the underlying lock.
def unlock(self):
API Documentation for Bazaar, generated by pydoctor at 2021-10-21 00:29:00.