[*] WaitMultipleLoopSourcesEx (any) fixes

This commit is contained in:
Reece Wilson 2024-09-09 12:40:49 +01:00
parent 634eb35959
commit e62a99777f
2 changed files with 56 additions and 40 deletions

View File

@ -126,7 +126,18 @@ namespace Aurora::IO::Loop
AuUInt lastHandle {}; AuUInt lastHandle {};
bool wasTriggered {}; bool wasTriggered {};
// first handle in group if (source->Singular())
{
auto handle = source->GetHandle();
if ((firstTriggered == handle) ||
(bAllowOthers && WaitForSingleObject(reinterpret_cast<HANDLE>(handle), 0) == WAIT_OBJECT_0))
{
lastHandle = handle;
wasTriggered = true;
}
}
else
{
for (const auto &handle : source->GetHandles()) for (const auto &handle : source->GetHandles())
{ {
if ((firstTriggered == handle) || if ((firstTriggered == handle) ||
@ -134,7 +145,8 @@ namespace Aurora::IO::Loop
{ {
lastHandle = handle; lastHandle = handle;
wasTriggered = true; wasTriggered = true;
continue; break;
}
} }
} }

View File

@ -375,7 +375,10 @@ namespace Aurora::IO::Loop
{ {
bZeroTick |= bool(signalTemp.size()); bZeroTick |= bool(signalTemp.size());
AuUInt32 uTimeoutMS {}; AuUInt32 uTimeoutMS {};
bool bTooMany {};
do
{
if (uTimeoutEnd) if (uTimeoutEnd)
{ {
auto uStartTime = Time::SteadyClockNS(); auto uStartTime = Time::SteadyClockNS();
@ -391,7 +394,6 @@ namespace Aurora::IO::Loop
} }
} }
bool bTooMany {};
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
if (AuBuild::kCurrentVendor == AuBuild::EVendor::eGenericMicrosoft && if (AuBuild::kCurrentVendor == AuBuild::EVendor::eGenericMicrosoft &&
lsList2.size() < MAXIMUM_WAIT_OBJECTS) lsList2.size() < MAXIMUM_WAIT_OBJECTS)
@ -415,6 +417,8 @@ namespace Aurora::IO::Loop
{ {
bTooMany = true; bTooMany = true;
} }
}
while (!bTimedout && !bTooMany && signaled.empty());
if (bTooMany) if (bTooMany)
{ {