diff --git a/Source/Threading/AuWakeOnAddress.cpp b/Source/Threading/AuWakeOnAddress.cpp index c28ce466..dab10d0b 100644 --- a/Source/Threading/AuWakeOnAddress.cpp +++ b/Source/Threading/AuWakeOnAddress.cpp @@ -51,8 +51,8 @@ namespace Aurora::Threading } static ProcessWaitContainer gProcessWaitables; - static int gShouldSpinOnlyInCPU = 1; // TODO: havent decided - + static const int gShouldSpinOnlyInCPU = 1; // TODO: havent decided + // UPDATE: 1 paranoia just in case we get preempted (rare). template static void DoSpinLockOnVar(T *uPointer) { @@ -969,7 +969,7 @@ namespace Aurora::Threading const void *pCompareAddress, WaitState &state) { - while (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + while (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { if (!SysWaitOnAddressNoTimed(pTargetAddress, pCompareAddress, state.uWordSize)) { @@ -984,13 +984,13 @@ namespace Aurora::Threading bool bSpun = false) { #if 1 - if (!WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + if (!WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { return true; } (void)RunOSWaitOnAddressTimed(pTargetAddress, pCompareAddress, state.uWordSize, state.qwNanosecondsAbs.value(), { }, { }, bSpun); - return !WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask); + return !WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask); #else return RunOSWaitOnAddressTimed(pTargetAddress, pCompareAddress, state.uWordSize, state.qwNanosecondsAbs.value(), { }, { }, bSpun); #endif @@ -1005,14 +1005,14 @@ namespace Aurora::Threading { WaitBuffer wb = WaitBuffer::From(pTargetAddress, state.uWordSize); - if (!WaitBuffer::Compare2(wb.buffer, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + if (!WaitBuffer::Compare2(wb.buffer, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { return; } (void)SysWaitOnAddressNoTimed(pTargetAddress, wb.buffer, state.uWordSize); - if (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + if (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { SysWakeOneOnAddress(pTargetAddress); } @@ -1033,14 +1033,14 @@ namespace Aurora::Threading { WaitBuffer wb = WaitBuffer::From(pTargetAddress, state.uWordSize); - if (!WaitBuffer::Compare2(wb.buffer, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + if (!WaitBuffer::Compare2(wb.buffer, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { return true; } bool bResult = RunOSWaitOnAddressTimed(pTargetAddress, wb.buffer, state.uWordSize, state.qwNanosecondsAbs.value(), { }, { }, bSpun); - if (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) + if (WaitBuffer::Compare2(pTargetAddress, state.uWordSize, pCompareAddress, state.uDownsizeMask)) { SysWakeOneOnAddress(pTargetAddress); if (!bResult) diff --git a/Source/Threading/AuWakeOnAddress.hpp b/Source/Threading/AuWakeOnAddress.hpp index 4a3f3b39..3ee494b3 100644 --- a/Source/Threading/AuWakeOnAddress.hpp +++ b/Source/Threading/AuWakeOnAddress.hpp @@ -25,6 +25,7 @@ namespace Aurora::Threading { static const auto kDefaultWaitPerProcess = 128; static const auto kMax64 = 0xFFFFFFFFFFFFFFFFull; + static const auto kPlatformFutexNoForcedAlignedU32 = AuBuild::kIsNTDerived; struct WaitState;