EtcPal  0.4.1
ETC Platform Abstraction Layer (EtcPal)
View other versions:
MutexGuard Class Reference

Overview

Lock guard around a mutex.

Lock is taken when this class is instantiated, and released when it goes out of scope. Example usage:

void Class::CriticalFunction()
{
etcpal::MutexGuard lock(mutex);
// Do critical section operations here
// Lock is released when it goes out of scope
}
Lock guard around a mutex.
Definition: mutex.h:173

Public Member Functions

 MutexGuard (Mutex &mutex)
 Lock an etcpal::Mutex. More...
 
 MutexGuard (etcpal_mutex_t &mutex)
 Lock an etcpal_mutex_t. More...
 
 ~MutexGuard ()
 Release the lock upon going out-of-scope.
 
 MutexGuard (const MutexGuard &other)=delete
 
MutexGuardoperator= (const MutexGuard &other)=delete
 
 MutexGuard (MutexGuard &&other)=delete
 
MutexGuardoperator= (MutexGuard &&other)=delete
 

Constructor & Destructor Documentation

◆ MutexGuard() [1/2]

MutexGuard ( Mutex mutex)
inlineexplicit

Lock an etcpal::Mutex.

Exceptions
std::runtime_errorif locking the mutex failed.

◆ MutexGuard() [2/2]

MutexGuard ( etcpal_mutex_t mutex)
inlineexplicit

Lock an etcpal_mutex_t.

Exceptions
std::runtime_errorif locking the mutex failed.

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