Acquire.ObjectStore._mutex module¶
-
class
Mutex(key=None, timeout=10, lease_time=10, bucket=None)[source]¶ Bases:
objectThis class implements a mutex that sits in the object store. The mutex is associated with a key. A thread holds this mutex if it has successfully written its secret to this key. If not, then another thread must hold the mutex, and we have to wait…
-
expired()[source]¶ Return whether or not this lock has expired
Returns: True if lock has expired, else False Return type: bool
-
is_locked()[source]¶ Return whether or not this mutex is locked
Returns: True if mutex locked, else False Return type: bool
-
lock(timeout=None, lease_time=None)[source]¶ Lock the mutex, blocking until the mutex is held, or until ‘timeout’ seconds have passed. If we time out, then an exception is raised. The lock is held for a maximum of ‘lease_time’ seconds.
Parameters: - timeout (int) – Number of seconds to block
- lease_time (int) – Number of seconds to hold the lock
Returns: None
-