[*] Amend: 5cafefae bad linux optimization (?)

This commit is contained in:
Reece Wilson 2024-07-31 12:01:31 +01:00
parent 5cafefae5d
commit 8545c59cba

View File

@ -46,7 +46,6 @@ 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)
{ {
@ -70,10 +69,11 @@ namespace Aurora::IO::Loop
// Don't acknowledge? // Don't acknowledge?
// Don't write into? // Don't write into?
// saves two syscalls for nothang // saves two syscalls for nothang
AuAtomicAdd(&this->uAtomicKernelSemaphore, 1u);
} }
else if (uCount) else if (uCount)
{ {
AuAtomicAdd(&this->uAtomicKernelSemaphore, uCount - 1); AuAtomicAdd(&this->uAtomicKernelSemaphore, uCount);
LSSemaphore::AddMany(uCount - 1); LSSemaphore::AddMany(uCount - 1);
} }
#else #else
@ -86,26 +86,17 @@ namespace Aurora::IO::Loop
else else
{ {
(void)LSSemaphore::OnTrigger(0); (void)LSSemaphore::OnTrigger(0);
bTriggerLater = false;
} }
} }
else if (uOld || !bRet) else if (uOld || !bRet)
{ {
(void)LSSemaphore::OnTrigger(0); (void)LSSemaphore::OnTrigger(0);
bTriggerLater = false;
} }
break; break;
} }
} }
#if 0
if (bTriggerLater)
{
(void)LSSemaphore::OnTrigger(0);
}
#endif
return bRet; return bRet;
} }