GClasses
|
On Windows, this implements a spin-lock. On Linux, this wraps pthread_mutex.
#include <GThread.h>
Public Member Functions | |
GSpinLock () | |
virtual | ~GSpinLock () |
bool | isLocked () |
void | lock (const char *szWhoHoldsTheLock) |
void | unlock () |
Static Public Member Functions | |
static void | test () |
Performs unit tests for this class. Throws an exception if there is a failure. More... | |
Protected Attributes | |
volatile long | m_dwLocked |
pthread_mutex_t | m_mutex |
maintaned on all platform as posix mutexes don't have a way to get current state. when not Win32 be aware that this value is shadowing the real mutex, and cannot be depended on especially in a MP enviroment. More... | |
GClasses::GSpinLock::GSpinLock | ( | ) |
|
virtual |
|
inline |
void GClasses::GSpinLock::lock | ( | const char * | szWhoHoldsTheLock | ) |
|
static |
Performs unit tests for this class. Throws an exception if there is a failure.
void GClasses::GSpinLock::unlock | ( | ) |
|
protected |
|
protected |
maintaned on all platform as posix mutexes don't have a way to get current state. when not Win32 be aware that this value is shadowing the real mutex, and cannot be depended on especially in a MP enviroment.