From d727859cc2e6a0e15a8daf558e5adf0976997f6a Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 10 Sep 2023 22:42:19 +0100 Subject: [PATCH] [*] Linux/Modern NT regression in new optimized event wait path --- Source/Threading/Primitives/AuEvent.cpp | 38 ++++++++++++------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/Source/Threading/Primitives/AuEvent.cpp b/Source/Threading/Primitives/AuEvent.cpp index 9b4b2576..b4c173a1 100644 --- a/Source/Threading/Primitives/AuEvent.cpp +++ b/Source/Threading/Primitives/AuEvent.cpp @@ -52,23 +52,22 @@ namespace Aurora::Threading::Primitives while (!AtomicIsEventSetLogicNoSpinNoLock()) { + bool bStatus {}; EventBits bits; bits.state = AuAtomicLoad(&this->state_); if (bits.bTriggered) { - AuAtomicAdd(pSleepCounter, 1u); - bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); - AuAtomicSub(pSleepCounter, 1u); - - if (!bStatus) - { - return false; - } + continue; } - else + + AuAtomicAdd(pSleepCounter, 1u); + bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); + AuAtomicSub(pSleepCounter, 1u); + + if (!bStatus) { - SMPPause(); + return false; } } } @@ -114,23 +113,22 @@ namespace Aurora::Threading::Primitives while (!AtomicIsEventSetLogicNoSpinNoLock()) { + bool bStatus {}; EventBits bits; bits.state = AuAtomicLoad(&this->state_); if (bits.bTriggered) { - AuAtomicAdd(pSleepCounter, 1u); - bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); - AuAtomicSub(pSleepCounter, 1u); - - if (!bStatus) - { - return false; - } + continue; } - else + + AuAtomicAdd(pSleepCounter, 1u); + bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); + AuAtomicSub(pSleepCounter, 1u); + + if (!bStatus) { - SMPPause(); + return false; } } }