[+] ICompletionGroup::WaitForAnyMS

[+] ICompletionGroup::WaitForAnyNS
This commit is contained in:
Reece Wilson 2024-01-05 12:06:17 +00:00
parent f1e170add0
commit 6d77a55d75
3 changed files with 31 additions and 0 deletions

View File

@ -35,6 +35,10 @@ namespace Aurora::IO::CompletionGroup
virtual AuSPtr<Loop::ILSEvent> GetTriggerLoopSource() = 0; virtual AuSPtr<Loop::ILSEvent> GetTriggerLoopSource() = 0;
virtual void TryTrigger() = 0; virtual void TryTrigger() = 0;
// 0 = indefinite
virtual bool WaitForAnyMS(AuUInt32 uTimeoutOrZeroMS = 0) = 0;
virtual bool WaitForAllMS(AuUInt32 uTimeoutOrZeroMS = 0) = 0;
}; };
AUKN_SYM AuSPtr<ICompletionGroup> NewCompletionGroup(); AUKN_SYM AuSPtr<ICompletionGroup> NewCompletionGroup();

View File

@ -151,6 +151,30 @@ namespace Aurora::IO::CompletionGroup
return this->anyProbablyAlwaysPresentEvent.GetLoopSource(); return this->anyProbablyAlwaysPresentEvent.GetLoopSource();
} }
bool CompletionGroup::WaitForAnyMS(AuUInt32 uTimeoutOrZeroMS)
{
if (auto pLoopSource = this->ToAnyLoopSource())
{
return pLoopSource->WaitOn(uTimeoutOrZeroMS);
}
else
{
return false;
}
}
bool CompletionGroup::WaitForAllMS(AuUInt32 uTimeoutOrZeroMS)
{
if (auto pLoopSource = this->ToAndLoopSource())
{
return pLoopSource->WaitOn(uTimeoutOrZeroMS);
}
else
{
return false;
}
}
void CompletionGroup::TryTrigger() void CompletionGroup::TryTrigger()
{ {
if (auto pSource = GetTriggerLoopSource()) if (auto pSource = GetTriggerLoopSource())

View File

@ -24,6 +24,9 @@ namespace Aurora::IO::CompletionGroup
AuSPtr<Async::IWorkItem> OnCompletion() override; AuSPtr<Async::IWorkItem> OnCompletion() override;
AuSPtr<Async::IWorkItem> OnSingleCompletion() override; AuSPtr<Async::IWorkItem> OnSingleCompletion() override;
bool WaitForAnyMS(AuUInt32 uTimeoutOrZeroMS) override;
bool WaitForAllMS(AuUInt32 uTimeoutOrZeroMS) override;
AuSPtr<Loop::ILSEvent> GetTriggerLoopSource() override; AuSPtr<Loop::ILSEvent> GetTriggerLoopSource() override;
void TryTrigger() override; void TryTrigger() override;