[*] NT: WaitMultipleLoopSourcesEx wasn't bypassing the wait cap

This commit is contained in:
Reece Wilson 2023-12-18 07:35:24 +00:00
parent f40d59802a
commit 22486b90e6
2 changed files with 29 additions and 11 deletions

View File

@ -12,7 +12,7 @@
namespace Aurora::IO::Loop
{
AuList<AuSPtr<ILoopSource>> WaitMultipleOrObjects(const AuList<AuSPtr<ILoopSource>> &objects, bool bZeroTick, AuUInt32 dwTimeoutReq)
AuList<AuSPtr<ILoopSource>> WaitMultipleOrObjects(const AuList<AuSPtr<ILoopSource>> &objects, bool bZeroTick, AuUInt32 dwTimeoutReq, bool &bTooMany)
{
bool isWinLoop;
AuList<AuSPtr<ILoopSourceEx>> loopSourceExs;
@ -63,6 +63,12 @@ namespace Aurora::IO::Loop
return {};
}
if (handleArray.size() >= MAXIMUM_WAIT_OBJECTS)
{
bTooMany = true;
return {};
}
for (const auto &source : loopSourceExs)
{
source->OnPresleep();

View File

@ -53,7 +53,7 @@ namespace Aurora::IO::Loop
}
#if defined(AURORA_IS_MODERNNT_DERIVED)
AuList<AuSPtr<ILoopSource>> WaitMultipleOrObjects(const AuList<AuSPtr<ILoopSource>> &objects, bool bZeroTick, AuUInt32 timeout);
AuList<AuSPtr<ILoopSource>> WaitMultipleOrObjects(const AuList<AuSPtr<ILoopSource>> &objects, bool bZeroTick, AuUInt32 timeout, bool &bTooMany);
#endif
AuList<AuSPtr<ILoopSource>> WaitMultipleOrObjectsFallback(const AuList<AuSPtr<ILoopSource>> &objects, AuUInt32 timeout, bool bZeroTick, bool &bTimeout);
@ -376,15 +376,27 @@ namespace Aurora::IO::Loop
}
}
#if defined(AURORA_IS_MODERNNT_DERIVED)
signaled = WaitMultipleOrObjects(lsList2, bZeroTick, uTimeoutMS);
bTimedout = uTimeoutEnd && uTimeoutMS && !bZeroTick ?
Time::SteadyClockNS() >= uTimeoutEnd :
false;
#else
signaled = WaitMultipleOrObjectsFallback(lsList2, uTimeoutMS, bZeroTick, bTimedout);
bTimedout &= !bZeroTick;
#endif
bool bTooMany {};
#if defined(AURORA_IS_MODERNNT_DERIVED)
if (AuBuild::kCurrentVendor == AuBuild::EVendor::eGenericMicrosoft &&
lsList2.size() < MAXIMUM_WAIT_OBJECTS)
{
signaled = WaitMultipleOrObjects(lsList2, bZeroTick, uTimeoutMS, bTooMany);
bTimedout = uTimeoutEnd && uTimeoutMS && !bZeroTick ?
Time::SteadyClockNS() >= uTimeoutEnd :
false;
}
else
#endif
{
bTooMany = true;
}
if (bTooMany)
{
signaled = WaitMultipleOrObjectsFallback(lsList2, uTimeoutMS, bZeroTick, bTimedout);
bTimedout &= !bZeroTick;
}
}
signaled.insert(signaled.end(), signalTemp.begin(), signalTemp.end());