cpp-pthread
(v1.7.3)
Simple C++ wrapper to pthread functions.
|
#include <lock_guard.hpp>
Public Member Functions | |
lock_guard (MutexType &m) | |
~lock_guard () | |
MutexType * | internal_mutex () |
void | operator= (lock_guard &)=delete |
Friends | |
class | condition_variable |
This class was designed to encapsulate a mutex and automatically control the lock attribute.
The lock_guard lock the associated mutex once we instanciate the class and the lock is automatically unlocked once the object is destroyed. This allow us to correlate the lock with the scope of the object.
Definition at line 38 of file lock_guard.hpp.
|
inlineexplicit |
The constructor is forced to only accept a mutex object or any object of a subclass.
The mutex is locked up upon completion.
m | reference to a valid pthread::mutex |
Definition at line 50 of file lock_guard.hpp.
|
inline |
The destructor release the guarded mutex.
Definition at line 57 of file lock_guard.hpp.
|
inline |
Definition at line 65 of file lock_guard.hpp.
|
delete |
Desabling the = operator.