A scoped lock that references any lockable. Locks on construction and unlocks on destruction.
More...
|
| | UniqueLock () |
| |
| | UniqueLock (Lockable &lock, lock::Op op=lock::Op::lock) |
| | Construct with a reference to a mutex and an operation to perform on construction. More...
|
| |
| template<class Rep , class Period > |
| | UniqueLock (Lockable &lock, Duration< Rep, Period > time) |
| |
| template<class Clock , class Dur > |
| | UniqueLock (Lockable &lock, TimePoint< Clock, Dur > time) |
| |
| | UniqueLock (UniqueLock &&rhs) noexcept |
| |
| | UniqueLock (SharedLock< Lockable > &&rhs) |
| | Unlock shared lock (reader) and block until unique lock (writer) is acquired. The shared lock is released. More...
|
| |
| | ~UniqueLock () |
| | Unlock the mutex if we own it. More...
|
| |
| UniqueLock & | operator= (UniqueLock &&rhs) |
| |
| UniqueLock & | operator= (SharedLock< Lockable > &&rhs) |
| |
| void | lock () |
| |
| void | unlock () |
| |
| bool | tryLock () |
| |
| template<class Rep , class Period > |
| bool | tryLock (Duration< Rep, Period > time) |
| |
| template<class Clock , class Dur > |
| bool | tryLock (TimePoint< Clock, Dur > time) |
| |
| bool | owns () const |
| | Check if mutex is locked by this instance. More...
|
| |
| | operator bool () const |
| | Same as owns() More...
|
| |
| Lockable & | mutex () |
| | Get the referenced mutex. More...
|
| |
| Lockable & | release () |
| | Release the mutex from further operations. The mutex will no longer be owned and its state will remain unchanged. More...
|
| |
template<class Lockable_>
class honey::UniqueLock< Lockable_ >
A scoped lock that references any lockable. Locks on construction and unlocks on destruction.
Instances are non-recursive (can't lock an instance twice), and can only be manipulated by one thread.
Note that if recursion is required, multiple instances can reference the same recursive lockable.