SpinLock Class Reference

#include <Pt/System/Mutex.h>

Lock object for spin mutexes.

Inherits NonCopyable.

Public Member Functions

 SpinLock (SpinMutex &m, bool doLock=true, bool isLocked=false)
 Construct to guard a SpinMutex. More...
 
 ~SpinLock ()
 Unlocks the mutex unless unlock() was called.
 
void lock ()
 Locks the mutex.
 
void unlock ()
 Unlocks the mutex.
 

Constructor & Destructor Documentation

SpinLock ( SpinMutex m,
bool  doLock = true,
bool  isLocked = false 
)

Constructs a SpinLock object and locks the enclosing spin mutex if doLock is true. If isLocked is true, the SpinLock will only unlock the given mutex in the destructor, but not lock it in the constructor.