API Reference¶
Abstract Base Classes¶
Base classes for distributed synchronization primitives
- class tutti.base.LockABC¶
Abstract base class for Lock primitive
Mostly compatible with
threading.Lock
.- abstract acquire(blocking: bool = True, timeout: Optional[float] = None) bool ¶
Acquire a lock.
- Parameters
- Returns
success – True if lock was acquired successfully, False otherwise.
- Return type
- abstract locked() bool ¶
Return True if the lock is locked
- Returns
locked – True if the lock is held by anyone, not just this process.
- Return type
- abstract release() None ¶
Release a lock.
- Returns
- Return type
- Raises
RuntimeError – if called on an unlocked Lock.
- class tutti.base.SemaphoreABC¶
Abstract Base Class for Semaphore primitive
Mostly compatible with
threading.Semaphore
.