AXCEL C++ Framework
Elegance through abstraction
|
Mutex. More...
#include <axcel.h>
Public Member Functions | |
virtual string | type () |
Get type of object. | |
virtual | operator string () |
Convert to string. | |
mutex () | |
~mutex () | |
void | lock () |
bool | trylock () |
void | unlock () |
Public Attributes | |
pthread_mutex_t | id |
Mutex.
Mutexes allow process and threads to access shared resources one at a time. What happens when 2 threads try to access a global variable at the same time!? A mutex is like a thread-safe boolean... not really. When a thread wants to access a shared resource, it will lock a mutex, then when it's done with the resource it will unlock the mutex. If a thread tries to lock an already locked mutex, then it will block until it becomes unlocked.
axcel::proc::mutex::operator string | ( | ) | [virtual] |
Convert to string.
Implements axcel::object.
string axcel::proc::mutex::type | ( | ) | [virtual] |
pthread_mutex_t axcel::proc::mutex::id |