[*] copy/pasted function parity

This commit is contained in:
Reece Wilson 2023-05-08 15:21:15 +01:00
parent a2cfb7765b
commit f842573352

View File

@ -75,12 +75,13 @@ namespace Aurora::Threading::Primitives
#else
auto &uValueRef = this->lock_.uWaitCount;
// Mirrors: ./AuMutex.NT.cpp
// keep this codeblock in parity
// defer to the comments in that source file
#if defined(AURORA_ARCH_X86) || defined(AURORA_ARCH_X64)
// Intel 64 and IA - 32 Architectures Software Developer's Manual, Volume 3A
// Section: 9.1.1
*(AuUInt8 *)&uValueRef = 0;
#else
AuAtomicAnd(&uValueRef, ~0xFFu);
InterlockedAndRelease((volatile LONG *)&uValueRef, ~0xFF);
#endif
while (true)
@ -99,9 +100,17 @@ namespace Aurora::Threading::Primitives
}
if (uValue & kFutexBitWake)
{
if (AuAtomicCompareExchange(&uValueRef, uValue, uValue) == uValue)
{
return;
}
else
{
SMPPause();
continue;
}
}
if (AuAtomicCompareExchange(&uValueRef, uValue - kFutexBitWait + kFutexBitWake, uValue) == uValue)
{