cxxtools::Mutex Class Reference

Mutual exclusion device. More...

#include <cxxtools/mutex.h>

Inheritance diagram for cxxtools::Mutex:

Public Member Functions

 Mutex ()
 Default constructor.
 ~Mutex ()
void lock ()
 Lock the mutex.
bool tryLock ()
void unlock ()
 Unlocks the mutex.
bool unlockNoThrow ()
 Unlocks the mutex.
MutexImpl & impl ()

Additional Inherited Members

- Private Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()

Detailed Description

Mutual exclusion device.

A Mutex is a mutual exclusion device. It is used to synchronize the access to data which is accessed by more than one thread or process at the same time. Mutexes are not recursive, that is the same thread can not lock a mutex multiple times without deadlocking.

Constructor & Destructor Documentation

cxxtools::Mutex::Mutex ( )

Default constructor.

cxxtools::Mutex::~Mutex ( )


The destructor destroys the mutex. The mutex must be in unlocked state when the destructor is called.

Member Function Documentation

MutexImpl& cxxtools::Mutex::impl ( )
void cxxtools::Mutex::lock ( )

Lock the mutex.

If the mutex is currently locked by another thread, the calling thread suspends until no other thread holds a lock on it. If the mutex is already locked by the calling thread a deadlock occurs.

bool cxxtools::Mutex::tryLock ( )
void cxxtools::Mutex::unlock ( )

Unlocks the mutex.

bool cxxtools::Mutex::unlockNoThrow ( )

Unlocks the mutex.

This method does not throw an exception if unlocking the mutex fails but simply returns false.

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