RTOS Wrapper
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
MutexGuard Class Reference

#include <MutexGuard.h>

Public Member Functions

 MutexGuard (OS_Mutex *mutex, bool *pSuccess)
 The constructor acquires the mutex, expected to wait forever.
 
 MutexGuard (OS_Mutex &mutex, bool *pSuccess)
 The constructor acquires the mutex, expected to wait forever.
 
 MutexGuard (Mutex &mutex, bool *pSuccess)
 The constructor acquires the mutex.
 
 MutexGuard (OS_Mutex *mutex, uint32_t maxMsecToWait=MaxWaitTimeMsec, bool *pSuccess=nullptr)
 The constructor acquires the mutex.
 
 MutexGuard (OS_Mutex &mutex, uint32_t maxMsecToWait=MaxWaitTimeMsec, bool *pSuccess=nullptr)
 The constructor acquires the mutex.
 
 MutexGuard (Mutex &mutex, uint32_t maxMsecToWait=MaxWaitTimeMsec, bool *pSuccess=nullptr)
 The constructor acquires the mutex.
 
 ~MutexGuard ()
 The destructor releases the lock on the mutex.
 

Static Public Attributes

static constexpr uint32_t MaxWaitTimeMsec = 250U
 
static constexpr uint32_t MaxInitializationTimeMsec = 10U
 TODO: This seems unreasonably long.. lets work down to about 100 msec.
 

Private Attributes

std::variant< OS_Mutex *, Mutex * > mutex
 Used for initial creation/lock.
 

Constructor & Destructor Documentation

◆ MutexGuard() [1/6]

MutexGuard::MutexGuard ( OS_Mutex *  mutex,
bool *  pSuccess 
)

The constructor acquires the mutex, expected to wait forever.

Parameters
mutexMutex to be acquired
[out]successA pointer to store success of mutex acquiring.

Return true in pointer if successful.

◆ MutexGuard() [2/6]

MutexGuard::MutexGuard ( OS_Mutex &  mutex,
bool *  pSuccess 
)

The constructor acquires the mutex, expected to wait forever.

Parameters
mutexMutex to be acquired
[out]successA pointer to store success of mutex acquiring.

Return true in pointer if successful.

◆ MutexGuard() [3/6]

MutexGuard::MutexGuard ( Mutex &  mutexArg,
bool *  pSuccess 
)

The constructor acquires the mutex.

Parameters
mutexMutex to be acquired
[out]successA pointer to store success of mutex acquiring.
mutexMutex to be acquired
maxMsecToWaitMax time to wait before timing out

◆ MutexGuard() [4/6]

MutexGuard::MutexGuard ( OS_Mutex *  mutexArg,
uint32_t  maxMsecToWait = MaxWaitTimeMsec,
bool *  pSuccess = nullptr 
)

The constructor acquires the mutex.

Parameters
mutexMutex to be acquired
maxMsecToWaitMax time to wait before timing out
[out]successA pointer to store success of mutex acquiring.

Return true in pointer if successful.

◆ MutexGuard() [5/6]

MutexGuard::MutexGuard ( OS_Mutex &  mutexArg,
uint32_t  maxMsecToWait = MaxWaitTimeMsec,
bool *  pSuccess = nullptr 
)

The constructor acquires the mutex.

Parameters
mutexMutex to be acquired
maxMsecToWaitMax time to wait before timing out
[out]successA pointer to store success of mutex acquiring.

Return true in pointer if successful.

◆ MutexGuard() [6/6]

MutexGuard::MutexGuard ( Mutex &  mutexArg,
uint32_t  maxMsecToWait = MaxWaitTimeMsec,
bool *  pSuccess = nullptr 
)

The constructor acquires the mutex.

Parameters
mutexMutex to be acquired
maxMsecToWaitMax time to wait before timing out
[out]successA pointer to store success of mutex acquiring.
mutexMutex to be acquired
maxMsecToWaitMax time to wait before timing out

◆ ~MutexGuard()

MutexGuard::~MutexGuard ( )

The destructor releases the lock on the mutex.

Member Data Documentation

◆ MaxInitializationTimeMsec

constexpr uint32_t MutexGuard::MaxInitializationTimeMsec = 10U
staticconstexpr

TODO: This seems unreasonably long.. lets work down to about 100 msec.

◆ MaxWaitTimeMsec

constexpr uint32_t MutexGuard::MaxWaitTimeMsec = 250U
staticconstexpr

◆ mutex

std::variant<OS_Mutex*, Mutex*> MutexGuard::mutex
mutableprivate

Used for initial creation/lock.


The documentation for this class was generated from the following files: