The Micro C++ Library
|
A Mutex provides mutual exclusive access to critical sections of concurrent threads. More...
#include <micxx.hxx>
Inherits micxx::traits::NonCopyable, and micxx::traits::ToString.
Inherited by micxx::Condition, micxx::Socket, micxx::SocketSet, micxx::SSLProtocol, and micxx::Thread.
Public Member Functions | |
Mutex () | |
Create a new Mutex. | |
virtual | ~Mutex () |
Deallocate and release the internally allocated mutex resources. | |
virtual unsigned | getLockCount () const |
The number of (recursive) locks that have been obtained by the same thread. | |
virtual void | lock () |
Try to obtain the lock from this Mutex. | |
virtual std::string | toString () const |
Returns a printable representation. | |
virtual void | unlock () |
Release the lock from this Mutex. | |
Protected Attributes | |
unsigned | lockCount |
The number of (recursive) locks that have been obtained by the same thread. | |
pthread_t | ownerId |
pthread_mutex_t | mutex |
A Mutex provides mutual exclusive access to critical sections of concurrent threads.
micxx::Mutex::Mutex | ( | ) |
Create a new Mutex.
virtual micxx::Mutex::~Mutex | ( | ) | [virtual] |
Deallocate and release the internally allocated mutex resources.
virtual unsigned micxx::Mutex::getLockCount | ( | ) | const [inline, virtual] |
The number of (recursive) locks that have been obtained by the same thread.
{ return lockCount; }
virtual void micxx::Mutex::lock | ( | ) | [virtual] |
Try to obtain the lock from this Mutex.
virtual std::string micxx::Mutex::toString | ( | ) | const [virtual] |
Returns a printable representation.
Reimplemented from micxx::traits::ToString.
Reimplemented in micxx::ServerSocket, micxx::Socket, micxx::SSLProtocol, and micxx::StreamSocket.
virtual void micxx::Mutex::unlock | ( | ) | [virtual] |
Release the lock from this Mutex.
0
, this Mutex is still locked by the calling thread.unsigned micxx::Mutex::lockCount [protected] |
The number of (recursive) locks that have been obtained by the same thread.
pthread_mutex_t micxx::Mutex::mutex [protected] |
pthread_t micxx::Mutex::ownerId [protected] |