Image Component Library (ICL)
|
Mutex class of the ICL. More...
#include <Mutex.h>
Classes | |
class | Locker |
Locks a mutex on the stack (mutex is unlocked when the stack's section is released. More... | |
Public Types | |
enum | MutexType { mutexTypeNormal = PTHREAD_MUTEX_NORMAL, mutexTypeRecursive = PTHREAD_MUTEX_RECURSIVE } |
This enum holds available mutex types. More... | |
Public Member Functions | |
Mutex (MutexType type=mutexTypeNormal) | |
Create a mutex. | |
~Mutex () | |
Destroys the mutex. | |
void | lock () |
locks the mutex | |
int | trylock () |
locks the mutex without blocking. returns immediately. | |
void | unlock () |
unlocks the mutex | |
Public Attributes | |
enum icl::utils::Mutex::MutexType | type |
Private Attributes | |
pthread_mutex_t | m |
wrapped thread_mutex_t struct | |
pthread_mutexattr_t | a |
wrapped thread_mutexattr struct |
Mutex class of the ICL.
This mutex class is a simple object oriented wrapper of the pthread_mutex_t struct.
Mutices can be:
icl::utils::Mutex::Mutex | ( | MutexType | type = mutexTypeNormal | ) | [inline] |
Create a mutex.
type | The default MutexType is MutexType::mutexTypeNormal |
icl::utils::Mutex::~Mutex | ( | ) | [inline] |
Destroys the mutex.
void icl::utils::Mutex::lock | ( | ) | [inline] |
locks the mutex
int icl::utils::Mutex::trylock | ( | ) | [inline] |
locks the mutex without blocking. returns immediately.
void icl::utils::Mutex::unlock | ( | ) | [inline] |
unlocks the mutex
pthread_mutexattr_t icl::utils::Mutex::a [private] |
wrapped thread_mutexattr struct
pthread_mutex_t icl::utils::Mutex::m [private] |
wrapped thread_mutex_t struct