libUTL++
utl::MutexGuard Class Reference

Acquire/release a Mutex RAII-style. More...

#include <Mutex.h>

Public Member Functions

 MutexGuard ()
 Default constructor. More...
 
 MutexGuard (Mutex *mutex)
 Constructor. More...
 
 ~MutexGuard ()
 Destructor. More...
 
void lock (Mutex *mutex)
 Lock a Mutex. More...
 
bool trylock (Mutex *mutex)
 Lock a new Mutex. More...
 
void unlock ()
 Unlock the Mutex. More...
 

Detailed Description

Acquire/release a Mutex RAII-style.

Author
Adam McKee

Definition at line 80 of file Mutex.h.

Constructor & Destructor Documentation

◆ MutexGuard() [1/2]

utl::MutexGuard::MutexGuard ( )
inline

Default constructor.

Definition at line 84 of file Mutex.h.

◆ MutexGuard() [2/2]

utl::MutexGuard::MutexGuard ( Mutex mutex)
inline

Constructor.

Parameters
mutexMutex to lock

Definition at line 93 of file Mutex.h.

References ASSERTD.

◆ ~MutexGuard()

utl::MutexGuard::~MutexGuard ( )
inline

Destructor.

Definition at line 101 of file Mutex.h.

Member Function Documentation

◆ lock()

void utl::MutexGuard::lock ( Mutex mutex)
inline

Lock a Mutex.

Parameters
mutexMutex to lock

Definition at line 111 of file Mutex.h.

References ASSERTD, and utl::Mutex::lock().

◆ trylock()

bool utl::MutexGuard::trylock ( Mutex mutex)
inline

Lock a new Mutex.

Parameters
mutexMutex to lock
Returns
true if lock acquired, false otherwise

Definition at line 125 of file Mutex.h.

References ASSERTD, and utl::Mutex::trylock().

◆ unlock()

void utl::MutexGuard::unlock ( )
inline

Unlock the Mutex.

Definition at line 142 of file Mutex.h.


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