Xyris  0.5
RAIIMutex Class Reference

#include <RAII.hpp>

+ Collaboration diagram for RAIIMutex:

Public Member Functions

 RAIIMutex (Mutex &mutex)
 
 ~RAIIMutex ()
 

Private Attributes

Mutexm_Mutex
 

Detailed Description

Definition at line 16 of file RAII.hpp.

Constructor & Destructor Documentation

◆ RAIIMutex()

RAIIMutex::RAIIMutex ( Mutex mutex)
inline

Construct a new RAIIMutex object that locks when constructed and unlocks when destructed.

Parameters
mutexMutex to use for RAII (un)locking

Definition at line 25 of file RAII.hpp.

26  : m_Mutex(mutex)
27  {
28  m_Mutex.lock();
29  }
+ Here is the call graph for this function:

◆ ~RAIIMutex()

RAIIMutex::~RAIIMutex ( )
inline

Destroy the RAIIMutex object and unlock the mutex.

Definition at line 35 of file RAII.hpp.

36  {
37  m_Mutex.unlock();
38  }
+ Here is the call graph for this function:

Field Documentation

◆ m_Mutex

Mutex& RAIIMutex::m_Mutex
private

Definition at line 41 of file RAII.hpp.


The documentation for this class was generated from the following file:
Mutex::unlock
bool unlock()
Release the mutex.
Definition: Mutex.cpp:38
RAIIMutex::m_Mutex
Mutex & m_Mutex
Definition: RAII.hpp:41
Mutex::lock
bool lock()
Aquire the mutex.
Definition: Mutex.cpp:20