Template Class ConditionalUniqueLock
Defined in File Utility.hpp
Class Documentation
-
template<typename Mutex>
class ConditionalUniqueLock Conditional unique lock.
Locks a mutex if a condition is true, and unlocks it when destroyed.
- Template Parameters:
Mutex – The mutex type
Public Functions
-
inline ConditionalUniqueLock(Mutex &mtx, bool should_lock)
Construct a new Conditional Lock Guard object.
Lock the mutex if should_lock is true.
- Parameters:
mtx – The mutex to lock
should_lock – Whether to lock the mutex
-
inline ~ConditionalUniqueLock()
Destroy the Conditional Lock Guard object.
Unlock the mutex if it was locked
-
inline void lock()
Lock the mutex.
-
inline void unlock()
Unlock the mutex.
-
ConditionalUniqueLock(const ConditionalUniqueLock&) = delete
-
ConditionalUniqueLock &operator=(const ConditionalUniqueLock&) = delete
-
ConditionalUniqueLock(ConditionalUniqueLock&&) = delete
-
ConditionalUniqueLock &operator=(ConditionalUniqueLock&&) = delete