/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: IWorkItemHandler.hpp Date: 2021-11-1 Author: Reece ***/ #pragma once namespace Aurora::Async { struct IWorkItemHandler { enum class EProcessNext { eInvalid = -1, eFinished = 0, eRerun, eSchedule, eFailed }; struct ProcessInfo { ProcessInfo(bool finished) : type(finished ? EProcessNext::eFinished : EProcessNext::eFailed) {} ProcessInfo(EProcessNext type) : type(type) {} ProcessInfo(const AuList> &blockedBy) : type(EProcessNext::eSchedule), waitFor(blockedBy) {} // ... EProcessNext type; AuList> waitFor; AuUInt32 reschedMs {}; AuUInt64 reschedNs {}; AuUInt32 reschedClockAbsMs {}; AuUInt64 reschedClockAbsNs {}; // @hideinitializer IThreadPool *pool; }; virtual void DispatchFrame(ProcessInfo &info) = 0; /// A really terrible name for the overloadable method that serves as the critical failure callback /// You have a 'shutdown'/free function you can overload, it's called the dtor /// Don't moan about the shitty naming of this, im not refactoring it virtual void Shutdown() = 0; virtual void *GetPrivateData() { return nullptr; } }; }