AuroraRuntime/Source/Async/AuAsyncTimer.hpp
Jamie Reece Wilson 8944d8bd16 [+] IAsyncTimer
[+] IAsyncTimerCallback
[+] ETickType.hpp
[+] EWorkPriority.hpp
[+] static IThreadPool::GetSelfIOProcessor()
[+] static IThreadPool::GetSelfIONetInterface()
[+] static IThreadPool::GetSelfIONetWorker()
[-] [Source/Async/]AsyncRunnable.hpp
[*] Begin encapsulating WorkerPId_t
[*] WorkerPId_t no longer take strong pointers to prevent leaks given that these identifiers are copied and kept alive everywhere
2023-12-07 09:20:23 +00:00

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 {};
};
}