SpinLock Class Reference

#include <Pt/System/Mutex.h>

Scoped lock for a SpinMutex.

Inherits NonCopyable.

Public Member Functions

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

Constructor & Destructor Documentation

◆ SpinLock()

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.