NonBlockingLock
This interface defines a non-blocking lock mechanism. It provides methods to attempt to acquire a lock without blocking and to release an acquired lock.
Methods
TryLock()
@classmethod
def TryLock() - > bool
Attempts to acquire the lock without blocking. Callers use this to try and gain exclusive access to a resource immediately.
Returns
| Type | Description |
|---|---|
bool | Returns true if the lock was successfully acquired, false otherwise. |
Release()
@classmethod
def Release()
Releases the lock, making it available for other callers to acquire. Callers use this to relinquish exclusive access to a resource after they are finished with it.