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