[*] FutexCondWaitable::NotifyOne was bothering me

This commit is contained in:
Reece Wilson 2023-08-26 18:43:57 +01:00
parent 610f2c73a0
commit 87c3ac790d

View File

@ -97,18 +97,16 @@ namespace Aurora::Threading::Waitables
auline void NotifyOne()
{
AuUInt32 uWaitCount {};
AuUInt32 uWaiters {};
uWaiters = AuAtomicLoad(&this->uAtomicSleeping);
if (uWaiters > 0)
AuUInt32 uWaiters = AuAtomicLoad(&this->uAtomicSleeping);
if (uWaiters == 0)
{
AuAtomicAdd(&this->uAtomicState, 1u);
WakeOnAddress((const void *)&this->uAtomicState);
uWaitCount = 1;
return;
}
while (AuAtomicCompareExchange(&this->uAtomicSleeping, uWaiters - uWaitCount, uWaiters) != uWaiters)
AuAtomicAdd(&this->uAtomicState, 1u);
WakeOnAddress((const void *)&this->uAtomicState);
while (AuAtomicCompareExchange(&this->uAtomicSleeping, uWaiters - 1u, uWaiters) != uWaiters)
{
uWaiters = this->uAtomicSleeping;