diff --git a/Source/Threading/AuWakeOnAddress.cpp b/Source/Threading/AuWakeOnAddress.cpp index c1c6565a..3343f4b7 100644 --- a/Source/Threading/AuWakeOnAddress.cpp +++ b/Source/Threading/AuWakeOnAddress.cpp @@ -1973,13 +1973,12 @@ namespace Aurora::Threading pCurrent->uOldStateChangedCounter = current.uHasStateChangedCounter; } - bool bFound {}; - bool bTimeout {}; + bool bFoundNotTriggered {}, bTimeout {}, bStatus {}; do { bool bRet = WaitForMultipleAddressesOr(waitMultipleOnAddress); - bFound = false; + bFoundNotTriggered = false; for (AU_ITERATE_N(i, uCount)) { @@ -1999,7 +1998,7 @@ namespace Aurora::Threading } else { - bFound = true; + bFoundNotTriggered = true; } } @@ -2009,7 +2008,16 @@ namespace Aurora::Threading break; } } - while (bFound); + while (bFoundNotTriggered); + + if (bTimeout) + { + bStatus = false; + } + else + { + bStatus = !bFoundNotTriggered; + } for (AU_ITERATE_N(i, uCount)) { @@ -2017,16 +2025,15 @@ namespace Aurora::Threading auto pCurrent = AuReinterpretCast(pBase[i].internalContext); current.bIgnoreCurrentFlag = pCurrent->bOldIgnore; - current.uHasStateChangedCounter = pCurrent->uOldStateChangedCounter + (bFound ? 0 : 1); + + if (current.bIgnoreCurrentFlag) + { + continue; + } + + current.uHasStateChangedCounter = pCurrent->uOldStateChangedCounter + (bStatus ? 1 : 0); } - if (!bFound) - { - return true; - } - else - { - return !bTimeout; - } + return bStatus; } } \ No newline at end of file