#include <mutex.h>
Collaboration diagram for FastMutex:
Public Member Functions | |
FastMutex () | |
Create a fast mutex. | |
~FastMutex () | |
void | lock () |
Lock the mutex. | |
bool | test () |
Try to lock the mutex: Non-blocking variant of lock(). | |
void | unlock () |
Unlock the mutex. | |
Private Attributes | |
GStaticMutex | m |
Friends | |
class | WaitCondition |
You CAN rely on RecursiveMutex being recursive but you should not rely on FastMutex being NOT recursive.
Definition at line 54 of file mutex.h.
|
Create a fast mutex.
Definition at line 20 of file mutex.cc. References m. |
|
Destroy a mutex. Make sure that the mutex is unlocked before destroying it. Definition at line 70 of file mutex.h. References m, and USE_PRIVATE__PTHREADS. |
|
Lock the mutex. If the mutex is currently unlocked, it becomes locked and owned by the calling thread, and the function returns immediately. If the mutex is already locked by another thread, this function suspends the calling thread until the mutex is unlocked. MAKE SURE that the mutex is NOT currently locked by the calling thread; otherwise deadlock occurs. Or, use a recursive mutex such as RecursiveMutex. Definition at line 89 of file mutex.h. References m, and USE_PRIVATE__PTHREADS. |
|
Try to lock the mutex: Non-blocking variant of lock().
Definition at line 102 of file mutex.h. References m, and USE_PRIVATE__PTHREADS. |
|
Unlock the mutex. The mutex is assumed to be locked and owned by the calling thread on entrance to this function. The thread will always be unlocked by a call to this function. Definition at line 115 of file mutex.h. References m, and USE_PRIVATE__PTHREADS. |
|
|
|
Definition at line 61 of file mutex.h. Referenced by FastMutex(), lock(), test(), unlock(), and ~FastMutex(). |