50 iLock.fSpinLock =
nullptr;
76 while(
fFlag.test_and_set(std::memory_order_acquire))
94 fFlag.clear(std::memory_order_release);
A simple implementation of a spin lock using the std::atomic_flag which is guaranteed to be atomic an...
Definition: SpinLock.h:32
SpinLock & operator=(SpinLock const &)=delete
friend class Lock
Definition: SpinLock.h:90
Lock(SpinLock *iSpinLock)
Definition: SpinLock.h:59
Lock acquire()
Definition: SpinLock.h:74
Lock & operator=(Lock const &)=delete
SpinLock()
Definition: SpinLock.h:67
SpinLock * fSpinLock
Definition: SpinLock.h:64
Lock(Lock &&iLock) noexcept
Definition: SpinLock.h:48
~Lock()
This will automatically release the lock.
Definition: SpinLock.h:42
void unlock()
Definition: SpinLock.h:92
Definition: SpinLock.h:36
std::atomic_flag fFlag
Definition: SpinLock.h:97