[+] ICompletionGroup::IsNeverEnding
[+] ICompletionGroup::SetNeverEnding
This commit is contained in:
parent
22a6338da4
commit
ba66c25651
@ -39,6 +39,9 @@ namespace Aurora::IO::CompletionGroup
|
||||
// 0 = indefinite
|
||||
virtual bool WaitForAnyMS(AuUInt32 uTimeoutOrZeroMS = 0) = 0;
|
||||
virtual bool WaitForAllMS(AuUInt32 uTimeoutOrZeroMS = 0) = 0;
|
||||
|
||||
virtual bool IsNeverEnding() = 0;
|
||||
virtual void SetNeverEnding(bool bValue) = 0;
|
||||
};
|
||||
|
||||
AUKN_SYM AuSPtr<ICompletionGroup> NewCompletionGroup();
|
||||
|
@ -55,6 +55,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
}
|
||||
|
||||
AuResetMember(this->callbackTicks);
|
||||
this->bTerminated = true;
|
||||
}
|
||||
|
||||
bool CompletionGroup::HasItemsActive()
|
||||
@ -62,7 +63,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
return this->workItems.size();
|
||||
}
|
||||
|
||||
void CompletionGroup::DoIOTick()
|
||||
void CompletionGroup::DoIOTick(bool bManual)
|
||||
{
|
||||
AuList<AuSPtr<ICompletionGroupWorkItem>> removedItems;
|
||||
|
||||
@ -131,7 +132,8 @@ namespace Aurora::IO::CompletionGroup
|
||||
}
|
||||
}
|
||||
|
||||
if (this->workItems.empty())
|
||||
if (this->workItems.empty() &&
|
||||
(bManual || !this->bIsNeverEnding))
|
||||
{
|
||||
this->andPlsDontAllocateFdIfUntouchedEvent.Set();
|
||||
|
||||
@ -175,6 +177,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
|
||||
void CompletionGroup::AddWorkItem(AuSPtr<ICompletionGroupWorkItem> pCompletable)
|
||||
{
|
||||
SysAssert(!this->bTerminated, "Completion group already terminated");
|
||||
AU_LOCK_GUARD(this->mutex);
|
||||
this->workItems.push_back(pCompletable);
|
||||
this->uAdded++;
|
||||
@ -186,6 +189,16 @@ namespace Aurora::IO::CompletionGroup
|
||||
this->callbackTicks.push_back(AuMakePair(pCallbackInvoker, bAny));
|
||||
}
|
||||
|
||||
bool CompletionGroup::IsNeverEnding()
|
||||
{
|
||||
return this->bIsNeverEnding;
|
||||
}
|
||||
|
||||
void CompletionGroup::SetNeverEnding(bool bValue)
|
||||
{
|
||||
this->bIsNeverEnding = bValue;
|
||||
}
|
||||
|
||||
AuSPtr<Loop::ILoopSource> CompletionGroup::ToAndLoopSource()
|
||||
{
|
||||
return this->andPlsDontAllocateFdIfUntouchedEvent.GetLoopSource();
|
||||
@ -232,7 +245,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
pSource->Set();
|
||||
}
|
||||
|
||||
this->DoIOTick();
|
||||
this->DoIOTick(true);
|
||||
}
|
||||
|
||||
AuSPtr<Async::IWorkItem> CompletionGroup::OnCompletion()
|
||||
|
@ -34,7 +34,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
AuPair<AuUInt32, AuUInt32> GetStats() override;
|
||||
void SetCallbacks(const AuSPtr<ICompletionGroupHooks> &pCallbacks) override;
|
||||
|
||||
void DoIOTick();
|
||||
void DoIOTick(bool bManual);
|
||||
|
||||
void ResetMemoryPins();
|
||||
bool HasItemsActive();
|
||||
@ -43,6 +43,9 @@ namespace Aurora::IO::CompletionGroup
|
||||
|
||||
void AddCallbackTick(const AuSPtr<IIOProcessorManualInvoker> &pCallbackInvoker, bool bAny);
|
||||
|
||||
bool IsNeverEnding() override;
|
||||
void SetNeverEnding(bool bValue) override;
|
||||
|
||||
private:
|
||||
AuMutex mutex;
|
||||
AuCriticalSection cs;
|
||||
@ -56,5 +59,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
AuUInt32 uAdded {};
|
||||
AuUInt32 uTriggered {};
|
||||
bool bNoAny {};
|
||||
bool bIsNeverEnding {};
|
||||
bool bTerminated {};
|
||||
};
|
||||
}
|
@ -23,7 +23,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
|
||||
void CompletionGroupAndedIOWorkItem::DispatchTask(Async::IWorkItemHandler::ProcessInfo &info)
|
||||
{
|
||||
this->pParent->DoIOTick();
|
||||
this->pParent->DoIOTick(false);
|
||||
|
||||
if (this->pParent->HasItemsActive())
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
return false;
|
||||
}
|
||||
|
||||
this->pParent->DoIOTick();
|
||||
this->pParent->DoIOTick(false);
|
||||
|
||||
if (this->bIsAnd)
|
||||
{
|
||||
@ -44,7 +44,7 @@ namespace Aurora::IO::CompletionGroup
|
||||
return false;
|
||||
}
|
||||
|
||||
this->pParent->DoIOTick();
|
||||
this->pParent->DoIOTick(false);
|
||||
|
||||
if (this->bIsAnd)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user