diff --git a/Source/IO/Loop/Loop.NT.cpp b/Source/IO/Loop/Loop.NT.cpp index 28a5130f..a1feede4 100644 --- a/Source/IO/Loop/Loop.NT.cpp +++ b/Source/IO/Loop/Loop.NT.cpp @@ -12,7 +12,7 @@ namespace Aurora::IO::Loop { - AuList> WaitMultipleOrObjects(const AuList> &objects, bool bZeroTick, AuUInt32 dwTimeoutReq) + AuList> WaitMultipleOrObjects(const AuList> &objects, bool bZeroTick, AuUInt32 dwTimeoutReq, bool &bTooMany) { bool isWinLoop; AuList> 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(); diff --git a/Source/IO/Loop/Loop.cpp b/Source/IO/Loop/Loop.cpp index e69daf5a..8970c1c8 100644 --- a/Source/IO/Loop/Loop.cpp +++ b/Source/IO/Loop/Loop.cpp @@ -53,7 +53,7 @@ namespace Aurora::IO::Loop } #if defined(AURORA_IS_MODERNNT_DERIVED) - AuList> WaitMultipleOrObjects(const AuList> &objects, bool bZeroTick, AuUInt32 timeout); + AuList> WaitMultipleOrObjects(const AuList> &objects, bool bZeroTick, AuUInt32 timeout, bool &bTooMany); #endif AuList> WaitMultipleOrObjectsFallback(const AuList> &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());