[*] 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,13 +52,17 @@ 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)
{ {
continue;
}
AuAtomicAdd(pSleepCounter, 1u); AuAtomicAdd(pSleepCounter, 1u);
bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime);
AuAtomicSub(pSleepCounter, 1u); AuAtomicSub(pSleepCounter, 1u);
if (!bStatus) if (!bStatus)
@ -66,11 +70,6 @@ namespace Aurora::Threading::Primitives
return false; return false;
} }
} }
else
{
SMPPause();
}
}
} }
else else
{ {
@ -114,13 +113,17 @@ 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)
{ {
continue;
}
AuAtomicAdd(pSleepCounter, 1u); AuAtomicAdd(pSleepCounter, 1u);
bool bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime); bStatus = InternalLTSWaitOnAddressHighRes(&this->state_, &bits.state, sizeof(bits.state), uEndTime);
AuAtomicSub(pSleepCounter, 1u); AuAtomicSub(pSleepCounter, 1u);
if (!bStatus) if (!bStatus)
@ -128,11 +131,6 @@ namespace Aurora::Threading::Primitives
return false; return false;
} }
} }
else
{
SMPPause();
}
}
} }
else else
{ {