GClasses

GClasses::GSpinLock Class Reference

A spin-lock for synchronization purposes. More...

#include <GSpinLock.h>

List of all members.

Public Member Functions

 GSpinLock ()
virtual ~GSpinLock ()
void lock (const char *szWhoHoldsTheLock)
void unlock ()
bool isLocked ()

Static Public Member Functions

static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure.

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.

Detailed Description

A spin-lock for synchronization purposes.


Constructor & Destructor Documentation

GClasses::GSpinLock::GSpinLock ( )
virtual GClasses::GSpinLock::~GSpinLock ( ) [virtual]

Member Function Documentation

bool GClasses::GSpinLock::isLocked ( ) [inline]
void GClasses::GSpinLock::lock ( const char *  szWhoHoldsTheLock)
static void GClasses::GSpinLock::test ( ) [static]

Performs unit tests for this class. Throws an exception if there is a failure.

void GClasses::GSpinLock::unlock ( )

Member Data Documentation

volatile long GClasses::GSpinLock::m_dwLocked [protected]
pthread_mutex_t GClasses::GSpinLock::m_mutex [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.