mirror of
https://github.com/emu-russia/pureikyubu.git
synced 2025-04-02 10:42:15 -04:00
17 lines
248 B
C++
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);
|
|
}
|