diff --git a/Source/Threading/AuWakeOnAddress.cpp b/Source/Threading/AuWakeOnAddress.cpp index 1f3809bc..6c75ec43 100644 --- a/Source/Threading/AuWakeOnAddress.cpp +++ b/Source/Threading/AuWakeOnAddress.cpp @@ -80,6 +80,15 @@ namespace Aurora::Threading this->Release(); } + static void FlushWaitBufferPAddressCache() + { + #if defined(MemoryBarrier) + MemoryBarrier(); + #else + asm volatile ("" : : : "memory"); + #endif + } + bool WaitEntry::SleepOn(WaitState &state) { #if !defined(WOA_SEMAPHORE_MODE) @@ -98,6 +107,8 @@ namespace Aurora::Threading while (uNow < uEndTime) { + FlushWaitBufferPAddressCache(); + if (!WaitBuffer::Compare(this->pAddress, this->uSize, state)) { return true; @@ -154,6 +165,8 @@ namespace Aurora::Threading this->variable.WaitForSignalNsEx(&this->mutex, 0, false); #endif } + + FlushWaitBufferPAddressCache(); } return true;