Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Types | Public Member Functions | Private Attributes
icl::utils::Mutex Class Reference

Mutex class of the ICL. More...

#include <Mutex.h>

Inheritance diagram for icl::utils::Mutex:
icl::utils::Uncopyable

List of all members.

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

Private Attributes

pthread_mutex_t m
 wrapped thread_mutex_t struct
pthread_mutexattr_t a
 wrapped thread_mutexattr struct

Detailed Description

Mutex class of the ICL.

This mutex class is a simple object oriented wrapper of the pthread_mutex_t struct.

Mutices can be:


Member Enumeration Documentation

This enum holds available mutex types.

Enumerator:
mutexTypeNormal 

normal mutex can not be locked by owner before unlocking

mutexTypeRecursive 

recursive mutex can be locked repeatedly by owner-thread. needs equal unlocks.


Constructor & Destructor Documentation

Create a mutex.

Parameters:
typeThe default MutexType is MutexType::mutexTypeNormal

Destroys the mutex.


Member Function Documentation

void icl::utils::Mutex::lock ( ) [inline]

locks the mutex

int icl::utils::Mutex::trylock ( ) [inline]

locks the mutex without blocking. returns immediately.

Returns:
zero if lock is acquired. otherwise an error-number
void icl::utils::Mutex::unlock ( ) [inline]

unlocks the mutex


Member Data Documentation

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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines