38 lines
1010 B
C++
38 lines
1010 B
C++
|
/***
|
||
|
Copyright (C) 2021-2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: AuAsyncTimer.hpp
|
||
|
Date: 2023-12-06
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
#include "WorkItem.hpp"
|
||
|
|
||
|
namespace Aurora::Async
|
||
|
{
|
||
|
struct AsyncFuncTimer :
|
||
|
WorkItem,
|
||
|
IAsyncTimer
|
||
|
{
|
||
|
AsyncFuncTimer(IThreadPoolInternal *owner,
|
||
|
const AuSPtr<IAsyncTimerCallback> &pCallback,
|
||
|
const WorkerPId_t &worker,
|
||
|
AuUInt64 uNextTickTime,
|
||
|
AuUInt64 uInterval);
|
||
|
|
||
|
void CancelTimer() override;
|
||
|
AuUInt64 GetLastTime() override;
|
||
|
AuUInt64 GetTicks() override;
|
||
|
|
||
|
void DispatchTask(IWorkItemHandler::ProcessInfo &info) override;
|
||
|
void Cleanup() override;
|
||
|
private:
|
||
|
AuSPtr<IAsyncTimerCallback> pCallback;
|
||
|
WorkerPId_t worker;
|
||
|
AuUInt64 uNextTickTime {};
|
||
|
AuUInt64 uLastTickTime {};
|
||
|
AuUInt64 uInterval {};
|
||
|
AuUInt64 uTickCount {};
|
||
|
};
|
||
|
}
|