[*] Fixup the WaitMultipleLoopSources Any path

This commit is contained in:
Reece Wilson 2023-10-21 09:27:52 +01:00
parent f185f13dc7
commit c79993af74

View File

@ -179,48 +179,57 @@ namespace Aurora::IO::Loop
}
else
{
auto start = lsList.begin();
auto type = lsList[0];
if (type->GetType() == ELoopSource::eSourceMutex ||
type->GetType() == ELoopSource::eSourceSemaphore ||
type->GetType() == ELoopSource::eSourceEvent)
{
for (AU_ITERATE_N(i, lsList.size()))
{
if (!lsList[i]->IsSignaled())
{
break;
}
bool bTimedout {};
AuList<AuSPtr<Loop::ILoopSource>> next;
AuList<AuSPtr<Loop::ILoopSource>> signalTemp;
start++;
for (const auto &pSource : lsList)
{
if (pSource->GetType() == ELoopSource::eSourceMutex ||
pSource->GetType() == ELoopSource::eSourceSemaphore ||
pSource->GetType() == ELoopSource::eSourceEvent)
{
if (pSource->IsSignaled())
{
signalTemp.push_back(pSource);
}
else
{
next.push_back(pSource);
}
}
else
{
next.push_back(pSource);
}
}
AuList<AuSPtr<Loop::ILoopSource>> next(start, lsList.end());
bool bTimeout {};
if (next.size())
{
if (signalTemp.size())
{
uTimeoutMS = 1;
}
#if defined(AURORA_IS_MODERNNT_DERIVED)
signaled = WaitMultipleOrObjects(next, uTimeoutMS);
bTimedout = uTimeoutMS ?
Time::SteadyClockNS() >= uTimeoutEnd :
false;
#else
signaled = WaitMultipleOrObjectsFallback(next, uTimeoutMS, bTimedout);
#endif
}
#if defined(AURORA_IS_MODERNNT_DERIVED)
signaled = WaitMultipleOrObjects(next, uTimeoutMS);
bTimeout = bTimeout ?
Time::SteadyClockNS() >= uTimeoutEnd :
false;
#else
signaled = WaitMultipleOrObjectsFallback(next, uTimeoutMS, bTimeout);
#endif
signaled.insert(signaled.end(), signalTemp.begin(), signalTemp.end());
signaled.insert(signaled.end(), lsList.begin(), start);
if (bTimeout)
if (bTimedout)
{
return false;
}
#if 0
return true;
#else
return signaled.size();
#endif
else
{
return signaled.size();
}
}
}