pureikyubu/SRC/Common/Spinlock.cpp
2020-04-11 00:09:28 +03:00

17 lines
248 B
C++

#include "pch.h"
void SpinLock::Lock()
{
while (_InterlockedCompareExchange(&_lock,
1, // exchange
0) // comparand
== 1)
{
// spin!
}
}
void SpinLock::Unlock()
{
_InterlockedExchange(&_lock, 0);
}