ORIGINAL
|
RAII wrapper for multiple mutex locking. More...
#include <mutex.h>
Public Member Functions | |
multiLock (MUTEX &... mutex) | |
Constructs a multiLock with AUTO_LOCK policy. | |
multiLock (lockPolicy policy, MUTEX &... mutex) | |
Constructs a multiLock with specified policy. | |
bool | isLocked () const noexcept override |
Checks if all mutexes are currently locked. | |
void | lock () override |
Locks all managed mutexes. | |
bool | tryLock () override |
Attempts to lock all managed mutexes without blocking. | |
void | unlock () override |
Unlocks all managed mutexes. | |
multiLock (multiLock &&)=delete | |
Deleted move constructor. | |
multiLock & | operator= (multiLock &&)=delete |
Deleted move assignment operator. | |
~multiLock () override | |
Destructor - automatically unlocks all 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 multiple mutex locking.
MUTEX | Variadic template parameter pack for mutex types |
Provides scoped lock management for multiple mutexes with deadlock avoidance and various locking policies.
|
explicit |
Constructs a multiLock with AUTO_LOCK policy.
mutex | References to mutexes to manage |
|
explicit |
Constructs a multiLock with specified policy.
policy | Locking policy to use |
mutex | References to mutexes to manage |
|
overridevirtualnoexcept |
Checks if all mutexes are currently locked.
Implements original::lockGuard.
|
overridevirtual |
Locks all managed mutexes.
sysError | if already locked or locking fails |
Implements original::lockGuard.
|
overridevirtual |
Attempts to lock all managed mutexes without blocking.
sysError | if already locked or operation fails |
Implements original::lockGuard.
|
overridevirtual |
Unlocks all managed mutexes.
sysError | if not locked or unlock fails |
Implements original::lockGuard.