[*] 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();
bool bTimedout {};
AuList<AuSPtr<Loop::ILoopSource>> next;
AuList<AuSPtr<Loop::ILoopSource>> signalTemp;
auto type = lsList[0];
if (type->GetType() == ELoopSource::eSourceMutex ||
type->GetType() == ELoopSource::eSourceSemaphore ||
type->GetType() == ELoopSource::eSourceEvent)
for (const auto &pSource : lsList)
{
for (AU_ITERATE_N(i, lsList.size()))
if (pSource->GetType() == ELoopSource::eSourceMutex ||
pSource->GetType() == ELoopSource::eSourceSemaphore ||
pSource->GetType() == ELoopSource::eSourceEvent)
{
if (!lsList[i]->IsSignaled())
if (pSource->IsSignaled())
{
break;
signalTemp.push_back(pSource);
}
start++;
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);
bTimeout = bTimeout ?
bTimedout = uTimeoutMS ?
Time::SteadyClockNS() >= uTimeoutEnd :
false;
#else
signaled = WaitMultipleOrObjectsFallback(next, uTimeoutMS, bTimeout);
signaled = WaitMultipleOrObjectsFallback(next, uTimeoutMS, bTimedout);
#endif
}
signaled.insert(signaled.end(), lsList.begin(), start);
signaled.insert(signaled.end(), signalTemp.begin(), signalTemp.end());
if (bTimeout)
if (bTimedout)
{
return false;
}
#if 0
return true;
#else
else
{
return signaled.size();
#endif
}
}
}