[*] Local loopsources werent calling the parents OnTrigger

This commit is contained in:
Reece Wilson 2023-12-01 10:55:24 +00:00
parent f05cafbff7
commit b0a7417d6f
3 changed files with 27 additions and 4 deletions

View File

@ -57,6 +57,7 @@ namespace Aurora::IO::Loop
} }
else else
{ {
(void)LSSemaphore::OnTrigger(0);
return false; return false;
} }
} }
@ -69,6 +70,7 @@ namespace Aurora::IO::Loop
} }
else else
{ {
(void)LSSemaphore::OnTrigger(0);
return false; return false;
} }
} }

View File

@ -37,6 +37,7 @@ namespace Aurora::IO::Loop
{ {
if (AuAtomicLoad(&this->uAtomicWord) & kFutexBitWake) if (AuAtomicLoad(&this->uAtomicWord) & kFutexBitWake)
{ {
(void)LSSemaphore::OnTrigger(0);
AuAtomicSub(&this->uAtomicWord, kFutexBitWake); AuAtomicSub(&this->uAtomicWord, kFutexBitWake);
} }

View File

@ -37,6 +37,7 @@ namespace Aurora::IO::Loop
bool LSLocalSemaphore::OnTrigger(AuUInt handle) bool LSLocalSemaphore::OnTrigger(AuUInt handle)
{ {
auto bRet = this->TryTakeNoSpin(); auto bRet = this->TryTakeNoSpin();
bool bTriggerLater = !bRet;
while (true) while (true)
{ {
@ -51,17 +52,36 @@ namespace Aurora::IO::Loop
{ {
auto uCount = AuAtomicLoad(&this->uAtomicSemaphore); auto uCount = AuAtomicLoad(&this->uAtomicSemaphore);
if (uOld - 1 == 0 && if (uOld - 1 == 0)
uCount)
{ {
AuAtomicAdd(&this->uAtomicKernelSemaphore, uCount); if (uCount)
LSSemaphore::AddMany(uCount); {
AuAtomicAdd(&this->uAtomicKernelSemaphore, uCount);
LSSemaphore::AddMany(uCount);
}
else
{
(void)LSSemaphore::OnTrigger(0);
bTriggerLater = false;
}
}
else if (uOld || !bRet)
{
(void)LSSemaphore::OnTrigger(0);
bTriggerLater = false;
} }
break; break;
} }
} }
#if 0
if (bTriggerLater)
{
(void)LSSemaphore::OnTrigger(0);
}
#endif
return bRet; return bRet;
} }