AuroraRuntime/Source/IO/IOProcessorItem.cpp

79 lines
1.9 KiB
C++
Raw Normal View History

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOProcessorItem.cpp
Date: 2022-6-6
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include <Aurora/IO/IOExperimental.hpp>
#include "IOProcessorItem.hpp"
#include "IOProcessor.hpp"
namespace Aurora::IO
{
bool IOProcessorItem::StopWatch()
{
if (this->parent->CheckThread() &&
this->parent->bFrameStart)
{
this->parent->ClearProcessor(AuSharedFromThis(), false);
return false;
}
return this->parent->items.ScheduleFinish(AuSharedFromThis(), false);
}
bool IOProcessorItem::FailWatch()
{
if (this->parent->CheckThread() &&
this->parent->bFrameStart)
{
this->parent->ClearProcessor(AuSharedFromThis(), true);
return false;
}
return this->parent->items.ScheduleFinish(AuSharedFromThis(), true);
}
bool IOProcessorItem::OnFinished(const AuSPtr<AuLoop::ILoopSource> &source)
{
IOAlert(false);
return false;
}
void IOProcessorItem::InvokeManualTick()
{
IOAlert(true);
}
void IOProcessorItem::IOAlert(bool force)
{
if (!this->parent->IsTickOnly())
{
2022-06-21 06:12:11 +00:00
if (!this->parent->bFrameStart)
{
this->parent->TickFor(AuSharedFromThis());
}
else
{
this->parent->TickForRegister(AuSharedFromThis());
}
}
else if (force) // manual tick
{
if (this->parent->CheckThread())
{
this->parent->TickFor(AuSharedFromThis());
}
else if (parent->IsAsync())
{
// TODO:
}
else
{
SysPanic("Missing");
}
}
}
}