/*** Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: IOProcessorItem.cpp Date: 2022-6-6 Author: Reece ***/ #include #include #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 &source) { IOAlert(false); return false; } void IOProcessorItem::InvokeManualTick() { IOAlert(true); } void IOProcessorItem::IOAlert(bool force) { if (!this->parent->IsTickOnly()) { 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"); } } } }