[*] Fix latency and internal tick wakeup filtering regressions in: 57c5515173

This commit is contained in:
Reece Wilson 2024-09-17 18:37:31 +01:00
parent 436d50a01f
commit fb1f53a930

View File

@ -765,7 +765,7 @@ namespace Aurora::IO::UNIX
do do
{ {
if (timeout && !bAgain) if (timeout && timeout != -1 && !bAgain)
{ {
AuUInt64 uTimeNow = AuTime::SteadyClockNS(); AuUInt64 uTimeNow = AuTime::SteadyClockNS();
if (uTargetTime <= uTimeNow) if (uTargetTime <= uTimeNow)
@ -782,7 +782,7 @@ namespace Aurora::IO::UNIX
{ {
break; break;
} }
temp = io_getevents(io->context, 1, uCount, ioEvents, timeout ? &targetTime : nullptr, false); temp = io_getevents(io->context, 1, uCount, ioEvents, timeout && timeout != -1 ? &targetTime : nullptr, false);
if (temp >= 0) if (temp >= 0)
{ {
@ -840,7 +840,7 @@ namespace Aurora::IO::UNIX
} }
} }
} }
while ((timeout ? !bEpollTriggered : false)); while ((timeout ? !(bEpollTriggered || toProcessDone) : false));
exit: exit:
bAgain = false; bAgain = false;
@ -886,6 +886,10 @@ namespace Aurora::IO::UNIX
{ {
return epoll_wait(epfd, events, maxevents, 0); return epoll_wait(epfd, events, maxevents, 0);
} }
else if (bRet && toProcessDone)
{
goto redo;
}
else if (bRet) else if (bRet)
{ {
return 0; return 0;
@ -988,7 +992,7 @@ namespace Aurora::IO::UNIX
do do
{ {
if (timeout && !bTryAgain) if (timeout && timeout != -1 && !bTryAgain)
{ {
AuUInt64 uTimeNow = AuTime::SteadyClockNS(); AuUInt64 uTimeNow = AuTime::SteadyClockNS();
if (uTargetTime <= uTimeNow) if (uTargetTime <= uTimeNow)
@ -1074,7 +1078,7 @@ namespace Aurora::IO::UNIX
} }
} }
while (timeout ? (!bReadTriggered && !bWriteTriggered) : false); while (timeout ? !(bWriteTriggered || bReadTriggered || toProcessDone) : false);
exit: exit:
bTryAgain = false; bTryAgain = false;
@ -1131,7 +1135,18 @@ namespace Aurora::IO::UNIX
} }
} }
return bRet; if (bReadTriggered || bWriteTriggered)
{
return true;
}
else if (bRet && toProcessDone)
{
goto redo;
}
else
{
return false;
}
} }
bool LinuxOverlappedWaitForAtleastOne(AuUInt32 timeout, const AuList<AuUInt> &handles, const AuList<AuUInt> &handlesWrite, AuUInt &one, AuUInt &two) bool LinuxOverlappedWaitForAtleastOne(AuUInt32 timeout, const AuList<AuUInt> &handles, const AuList<AuUInt> &handlesWrite, AuUInt &one, AuUInt &two)