39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: LSTimer.NT.hpp
|
|
Date: 2021-10-1
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
#include "LSHandle.hpp"
|
|
|
|
namespace Aurora::IO::Loop
|
|
{
|
|
struct LSTimer : ITimer, virtual LSHandle
|
|
{
|
|
LSTimer(AuUInt32 reschedStepMsOrZero, AuUInt32 maxIterationsOrZero, bool bSingleshot, HANDLE handle);
|
|
~LSTimer();
|
|
|
|
virtual void UpdateTime(AuUInt64 absTimeMs) override;
|
|
virtual void UpdateTimeNs(AuUInt64 absTimeNs) override;
|
|
virtual void UpdateTickRateIfAny(AuUInt32 reschedStepMsOrZero, AuUInt32 maxIterationsOrZero) override;
|
|
virtual void UpdateTickRateIfAnyNs(AuUInt64 reschedStepNsOrZero, AuUInt32 maxIterationsOrZero) override;
|
|
virtual void Stop() override;
|
|
|
|
virtual bool OnTrigger(AuUInt handle) override;
|
|
|
|
virtual bool IsSignaled() override;
|
|
virtual bool WaitOn(AuUInt32 timeout) override;
|
|
virtual ELoopSource GetType() override;
|
|
|
|
void UpdateTimeInternal(AuUInt64 absTimeNs);
|
|
|
|
private:
|
|
AuUInt64 reschedStepNsOrZero_ {0};
|
|
AuUInt32 maxIterationsOrZero_ {0};
|
|
AuUInt64 targetTime_ {0};
|
|
AuUInt32 count_ {0};
|
|
bool bSingleshot {};
|
|
};
|
|
} |