/*** 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 { AUE_DEFINE(ETickType, ( eFinished, eRerun, eSchedule, eFailed )); struct IWorkItemHandler { struct ProcessInfo { inline ProcessInfo(bool finished) : type(finished ? ETickType::eFinished : ETickType::eFailed) {} inline ProcessInfo(ETickType type) : type(type) {} inline ProcessInfo(const AuList> &blockedBy) : type(ETickType::eSchedule), waitFor(blockedBy) {} // ... ETickType 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 /// This may run from any thread inline virtual void OnFailure() {}; inline virtual void *GetPrivateData() { return nullptr; } }; }