Structural deformable models
|
#include <vuThread.h>
Public Member Functions | |
vuMutex (bool recursive=false) | |
~vuMutex () | |
void | lock () |
bool | trylock () |
void | unlock () |
Friends | |
class | vuLock |
Wrapper class for POSIX mutex. A mutex can be locked and unlocked. If a locked mutex is tried to be locked againg (e.g. by a parallel running thread) the thread is blocked until the mutex is free again. This can be used to manage access to shared resources or synchronize between different threads.
Definition at line 28 of file vuThread.h.
vuMutex::vuMutex | ( | bool | recursive = false | ) |
Default constructor. Calls pthread_mutex_init()
Definition at line 117 of file vuThread.cpp.
References NULL.
Referenced by unlock().
vuMutex::~vuMutex | ( | ) |
Destructor. Calls pthread_mutex_destroy()
Definition at line 132 of file vuThread.cpp.
Referenced by unlock().
void vuMutex::lock | ( | ) |
Locks the mutex. If the mutex has already been locked by another process this function waits until the mutex is free. This is the recommended method to synchronize between threads. While waiting for the mutex to get free no cpu time is waisted.
Definition at line 138 of file vuThread.cpp.
Referenced by Brain::run(), unlock(), and Brain::~Brain().
bool vuMutex::trylock | ( | ) |
Try to lock the mutex. Same as lock() but if mutex is busy the calling thread is not blocked.
Definition at line 143 of file vuThread.cpp.
Referenced by unlock().
void vuMutex::unlock | ( | ) |
Unlock the mutex. Allow other threads to lock the mutex. If you forget this the program will get stuck...
Definition at line 148 of file vuThread.cpp.
References _kickoff(), lock(), NULL, vuThread::run(), vuThread::startThread(), vuThread::stopThread(), trylock(), unlock(), vuThread::usleep(), vuMutex(), and ~vuMutex().
Referenced by _kickoff(), Brain::run(), unlock(), and Brain::~Brain().
|
friend |
Definition at line 30 of file vuThread.h.