112 lines
2.7 KiB
C++
112 lines
2.7 KiB
C++
/***
|
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuIOWaitableIOCompletionGroup.cpp
|
|
Date: 2024-1-6
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include <Aurora/IO/IOExperimental.hpp>
|
|
#include "AuIOWaitableIOCompletionGroup.hpp"
|
|
#include <Source/IO/CompletionGroup/CompletionGroup.hpp>
|
|
|
|
namespace Aurora::IO
|
|
{
|
|
IOWaitableIOCompletionGroup::IOWaitableIOCompletionGroup(const AuSPtr<IO::CompletionGroup::ICompletionGroup> &pGroup,
|
|
bool bAny) :
|
|
pGroup(pGroup),
|
|
bAny(bAny)
|
|
{
|
|
|
|
}
|
|
|
|
IOWaitableIOCompletionGroup::IOWaitableIOCompletionGroup() :
|
|
bAny { true }
|
|
{
|
|
|
|
}
|
|
|
|
void IOWaitableIOCompletionGroup::SetGroup(const AuSPtr<IO::CompletionGroup::ICompletionGroup> &pGroup)
|
|
{
|
|
this->pGroup = pGroup;
|
|
|
|
if (this->pParent)
|
|
{
|
|
this->Bind(this->pGroup, this->pParent);
|
|
}
|
|
else
|
|
{
|
|
// wait
|
|
}
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::IsRunOnOtherTick()
|
|
{
|
|
return {};
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::IsRunOnTick()
|
|
{
|
|
return {};
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::CanRequestTick()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void IOWaitableIOCompletionGroup::OnReportPumper(const AuSPtr<IIOProcessorManualInvoker> &iface)
|
|
{
|
|
this->pParent = iface;
|
|
|
|
if (this->pGroup)
|
|
{
|
|
this->Bind(this->pGroup, this->pParent);
|
|
}
|
|
}
|
|
|
|
void IOWaitableIOCompletionGroup::Bind(const AuSPtr<IO::CompletionGroup::ICompletionGroup> &pGroup,
|
|
const AuSPtr<IIOProcessorManualInvoker> &pParent)
|
|
{
|
|
AuStaticCast<CompletionGroup::CompletionGroup>(pGroup)->AddCallbackTick(pParent, this->bAny);
|
|
AuResetMember(this->pGroup);
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::IsRunOnSelfIO()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
AuSPtr<Loop::ILoopSource> IOWaitableIOCompletionGroup::GetSelfIOSource()
|
|
{
|
|
return {};
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::ApplyRateLimit()
|
|
{
|
|
return {};
|
|
}
|
|
|
|
bool IOWaitableIOCompletionGroup::IsRunOnSelfIOCheckedOnTimerTick()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
AuUInt32 IOWaitableIOCompletionGroup::IOTimeoutInMS()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<IIOWaitableItem> NewWaitableItemForSleepingCompletionGroup(const AuSPtr<IO::CompletionGroup::ICompletionGroup> &pGroup,
|
|
bool bAny)
|
|
{
|
|
auto pThat = AuMakeShared<IOWaitableIOCompletionGroup>(pGroup, bAny);
|
|
if (!pThat)
|
|
{
|
|
SysPushErrorMemory();
|
|
return {};
|
|
}
|
|
|
|
return pThat;
|
|
}
|
|
} |