Yate
|
Ephemeral mutex, semaphore or rw-lock locking object. More...
#include <yateclass.h>
Public Member Functions | |
Lock (Lockable &lck, long maxwait=-1, bool readLock=false) | |
Lock (Lockable *lck, long maxwait=-1, bool readLock=false) | |
~Lock () | |
Lockable * | locked () const |
void | drop () |
bool | acquire (Lockable *lck, long maxwait=-1, bool readLock=false) |
bool | acquire (Lockable &lck, long maxwait=-1, bool readLock=false) |
Ephemeral mutex, semaphore or rw-lock locking object.
A lock is a stack allocated (automatic) object that locks a lockable object on creation and unlocks it on destruction - typically when exiting a block
|
inline |
Destroy the lock, unlock the mutex if it was locked
|
inline |
|
inline |
Attempt to acquire a new lock on another object
lck | Pointer to the object to lock |
maxwait | Time in microseconds to wait, -1 wait forever |
readLock | Read lock a RWLock |
References Lockable::lock(), Lockable::lockableRWLock(), and RWLock::readLock().
|
inline |
Unlock the object if it was locked and drop the reference to it
|
inline |
Return a pointer to the lockable object this lock holds