#include <vuThread.h>
Collaboration diagram for vuMutex:
Public Member Functions | |
vuMutex () | |
Default constructor. | |
~vuMutex () | |
Destructor. | |
void | lock () |
Locks the mutex. | |
bool | trylock () |
Try to lock the mutex. | |
void | unlock () |
Unlock the mutex. | |
Private Attributes | |
void * | mutex |
Friends | |
class | vuLock |
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 48 of file vuThread.h.
|
Default constructor. Calls pthread_mutex_init() Definition at line 111 of file vuThread.cpp. |
|
Destructor. Calls pthread_mutex_destroy() Definition at line 117 of file vuThread.cpp. References mutex. |
|
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 123 of file vuThread.cpp. References mutex. Referenced by vu1112117::computeSlicesUsingThreads(), vu1512112::drawSlices(), vu1112117::refineSlicesUsingThreads(), ns_vu1112112::vu1112112::render(), vu1112113::render(), and vuThread::startThread(). |
|
Try to lock the mutex. Same as lock() but if mutex is busy the calling thread is not blocked.
Definition at line 128 of file vuThread.cpp. References mutex. |
|
Unlock the mutex. Allow other threads to lock the mutex. If you forget this the program will get stuck... Definition at line 133 of file vuThread.cpp. References mutex. Referenced by _kickoff(), vu1112117::computeSlicesUsingThreads(), vu1512112::drawSlices(), vu1112117::refineSlicesUsingThreads(), ns_vu1112112::vu1112112::render(), vu1112113::render(), ns_vu1112112::vu1112112::run(), vu1112113::run(), and vu1112117::run(). |
|
Definition at line 50 of file vuThread.h. |
|
Definition at line 74 of file vuThread.h. Referenced by lock(), trylock(), unlock(), vuMutex(), and ~vuMutex(). |