ManaPlus
Public Member Functions | Private Attributes
MutexLocker Class Reference

#include <mutex.h>

Public Member Functions

 MutexLocker (Mutex *const mutex)
 
 MutexLocker (const MutexLocker &m)
 
 ~MutexLocker ()
 

Private Attributes

MutexmMutex
 

Detailed Description

A convenience class for locking a mutex.

Definition at line 56 of file mutex.h.

Constructor & Destructor Documentation

◆ MutexLocker() [1/2]

MutexLocker::MutexLocker ( Mutex *const  mutex)
inlineexplicit

Definition at line 98 of file mutex.h.

98  :
99  mMutex(mutex)
100 {
101  if (mMutex != nullptr)
102  mMutex->lock();
103 }
Mutex * mMutex
Definition: mutex.h:71
void lock()
Definition: mutex.h:85

References Mutex::lock(), and mMutex.

◆ MutexLocker() [2/2]

MutexLocker::MutexLocker ( const MutexLocker m)
inline

Definition at line 61 of file mutex.h.

61  :
62  mMutex(m.mMutex)
63  {
64  }

◆ ~MutexLocker()

MutexLocker::~MutexLocker ( )
inline

Definition at line 105 of file mutex.h.

106 {
107  if (mMutex != nullptr)
108  mMutex->unlock();
109 }
void unlock()
Definition: mutex.h:91

References mMutex, and Mutex::unlock().

Field Documentation

◆ mMutex

Mutex* MutexLocker::mMutex
private

Definition at line 71 of file mutex.h.

Referenced by MutexLocker(), and ~MutexLocker().


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