2021-11-05 17:34:23 +00:00
|
|
|
/***
|
|
|
|
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
|
|
|
|
{
|
|
|
|
struct ProcessInfo
|
|
|
|
{
|
2022-05-30 08:46:24 +00:00
|
|
|
inline ProcessInfo(bool finished) : type(finished ? ETickType::eFinished : ETickType::eFailed) {}
|
|
|
|
inline ProcessInfo(ETickType type) : type(type) {}
|
|
|
|
inline ProcessInfo(const AuList<AuSPtr<IWorkItem>> &blockedBy) : type(ETickType::eSchedule), waitFor(blockedBy) {}
|
2021-11-05 17:34:23 +00:00
|
|
|
// ...
|
|
|
|
|
2022-05-16 23:41:27 +00:00
|
|
|
ETickType type;
|
2021-11-05 17:34:23 +00:00
|
|
|
AuList<AuSPtr<IWorkItem>> waitFor;
|
2021-11-08 00:11:01 +00:00
|
|
|
AuUInt32 reschedMs {};
|
|
|
|
AuUInt64 reschedNs {};
|
|
|
|
AuUInt32 reschedClockAbsMs {};
|
|
|
|
AuUInt64 reschedClockAbsNs {};
|
2023-10-31 21:07:42 +00:00
|
|
|
AuUInt64 reschedSteadyClockAbsNs {};
|
2023-12-01 09:22:51 +00:00
|
|
|
AuSPtr<IO::Loop::ILoopSource> pLoopSource {};
|
2021-11-05 17:34:23 +00:00
|
|
|
// @hideinitializer
|
|
|
|
IThreadPool *pool;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual void DispatchFrame(ProcessInfo &info) = 0;
|
|
|
|
|
|
|
|
/// A really terrible name for the overloadable method that serves as the critical failure callback
|
2022-05-16 23:41:27 +00:00
|
|
|
/// This may run from any thread
|
2022-06-11 23:01:27 +00:00
|
|
|
inline virtual void OnFailure() {};
|
2021-11-05 17:34:23 +00:00
|
|
|
|
2022-06-11 23:01:27 +00:00
|
|
|
inline virtual void *GetPrivateData() { return nullptr; }
|
2021-11-05 17:34:23 +00:00
|
|
|
};
|
|
|
|
}
|