ORIGINAL
|
RAII wrapper for single mutex locking. More...
#include <mutex.h>
Public Member Functions | |
uniqueLock (pMutex &p_mutex, lockPolicy policy=AUTO_LOCK) | |
Constructs a uniqueLock with specified policy. | |
uniqueLock (uniqueLock &&)=delete | |
Deleted move constructor. | |
uniqueLock & | operator= (uniqueLock &&)=delete |
Deleted move assignment operator. | |
bool | isLocked () const noexcept override |
Checks if the lock is currently held. | |
void | lock () override |
Locks the associated mutex. | |
bool | tryLock () override |
Attempts to lock the associated mutex without blocking. | |
void | unlock () override |
Unlocks the associated mutex. | |
~uniqueLock () override | |
Destructor - automatically unlocks if locked. | |
![]() | |
lockGuard ()=default | |
Default constructor. | |
lockGuard (const lockGuard &)=delete | |
Deleted copy constructor. | |
lockGuard & | operator= (const lockGuard &)=delete |
Deleted copy assignment operator. | |
virtual | ~lockGuard ()=default |
Virtual destructor. | |
Additional Inherited Members | |
![]() | |
enum class | lockPolicy { MANUAL_LOCK , AUTO_LOCK , TRY_LOCK , ADOPT_LOCK } |
Locking policies for guard construction. More... | |
![]() | |
static constexpr auto | MANUAL_LOCK = lockPolicy::MANUAL_LOCK |
Constant for manual lock policy. | |
static constexpr auto | AUTO_LOCK = lockPolicy::AUTO_LOCK |
Constant for automatic lock policy. | |
static constexpr auto | TRY_LOCK = lockPolicy::TRY_LOCK |
Constant for try-lock policy. | |
static constexpr auto | ADOPT_LOCK = lockPolicy::ADOPT_LOCK |
Constant for adopt lock policy. | |
RAII wrapper for single mutex locking.
Provides scoped lock management for a single pMutex with various locking policies.
|
inlineexplicit |
Constructs a uniqueLock with specified policy.
p_mutex | Mutex to manage |
policy | Locking policy (default: AUTO_LOCK) |
sysError | if locking fails |
|
inlineoverridevirtualnoexcept |
Checks if the lock is currently held.
Implements original::lockGuard.
|
inlineoverridevirtual |
Locks the associated mutex.
sysError | if already locked or locking fails |
Implements original::lockGuard.
|
inlineoverridevirtual |
Attempts to lock the associated mutex without blocking.
sysError | if already locked or operation fails |
Implements original::lockGuard.
|
inlineoverridevirtual |
Unlocks the associated mutex.
sysError | if not locked or unlock fails |
Implements original::lockGuard.