/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: IWorkItem.hpp Date: 2021-11-1 Author: Reece ***/ #pragma once namespace Aurora::Async { struct IWorkItem { virtual AuSPtr WaitFor(const AuSPtr &pWorkItem) = 0; virtual AuSPtr WaitFor(const AuList> &workItems) = 0; // do not schedule a loop-source more than once // you may ILoopSource::WaitOn arbitrarily; however, you must not attach it to the threads loopqueue more than once. virtual AuSPtr SetSchedByLoopSourceOnce(const AuSPtr &pLoopSource) = 0; virtual AuSPtr SetSchedByLoopSourceRepeating(const AuSPtr &pLoopSource) = 0; // ms = time relative to the current time in milliseconds virtual AuSPtr SetSchedTime(AuUInt32 ms) = 0; // ns = time relative to the current time in nanoseconds virtual AuSPtr SetSchedTimeNs(AuUInt64 ns) = 0; // ms = wall time (AuTime::CurrentClockMS()) in milliseconds virtual AuSPtr SetSchedTimeAbs(AuUInt32 ms) = 0; // ns = wall time (AuTime::CurrentClockNS()) in nanoseconds virtual AuSPtr SetSchedTimeNsAbs(AuUInt64 ns) = 0; // ns = steady time (AuTime::SteadyClockNS()) in nanoseconds virtual AuSPtr SetSchedSteadyTimeNsAbs(AuUInt64 ns) = 0; // ms = time relative to the time at which the work item would otherwise dispatch virtual AuSPtr AddDelayTime(AuUInt32 ms) = 0; // ns = time relative to the time at which the work item would otherwise dispatch virtual AuSPtr AddDelayTimeNs(AuUInt64 ns) = 0; // ms = time relative to the time at which the work item would otherwise dispatch virtual AuSPtr AddDelayTimeRepeating(AuUInt32 ms) = 0; // ns = time relative to the time at which the work item would otherwise dispatch virtual AuSPtr AddDelayTimeNsRepeating(AuUInt64 ns) = 0; // inverted WaitFor virtual AuSPtr Then(const AuSPtr &next) = 0; virtual AuSPtr Dispatch() = 0; virtual void SetPrio(EWorkPriority prio) = 0; virtual bool BlockUntilComplete() = 0; virtual bool HasFinished() = 0; virtual bool HasFailed() = 0; virtual void Cancel() = 0; virtual void *GetPrivateData() = 0; }; }