[*] Linux/Modern NT regression in new optimized event wait path

This commit is contained in:
Reece Wilson 2023-09-10 22:42:19 +01:00
parent 22efbff12f
commit d727859cc2

View File

@ -52,23 +52,22 @@ namespace Aurora::Threading::Primitives
while (!AtomicIsEventSetLogicNoSpinNoLock()) while (!AtomicIsEventSetLogicNoSpinNoLock())
{ {
bool bStatus {};
EventBits bits; EventBits bits;
bits.state = AuAtomicLoad(&this->state_); bits.state = AuAtomicLoad(&this->state_);
if (bits.bTriggered) if (bits.bTriggered)
{ {
AuAtomicAdd(pSleepCounter, 1u); continue;
bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime);
AuAtomicSub(pSleepCounter, 1u);
if (!bStatus)
{
return false;
}
} }
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()) while (!AtomicIsEventSetLogicNoSpinNoLock())
{ {
bool bStatus {};
EventBits bits; EventBits bits;
bits.state = AuAtomicLoad(&this->state_); bits.state = AuAtomicLoad(&this->state_);
if (bits.bTriggered) if (bits.bTriggered)
{ {
AuAtomicAdd(pSleepCounter, 1u); continue;
bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime);
AuAtomicSub(pSleepCounter, 1u);
if (!bStatus)
{
return false;
}
} }
else
AuAtomicAdd(pSleepCounter, 1u);
bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime);
AuAtomicSub(pSleepCounter, 1u);
if (!bStatus)
{ {
SMPPause(); return false;
} }
} }
} }