AuroraRuntime/Source/IO/Loop/LSTimer.Linux.hpp
J Reece Wilson 35761edaec [+] AuIO::Loop::NewLSTimerHighResolution
[*] ILSTimer::UpdateTime -> ILSTimer::UpdateTimeWall
[*] ILSTimer::UpdateTimeNs -> ILSTimer::UpdateTimeWallNs
[+] ILSTimer::UpdateTimeSteady
[+] ILSTimer::UpdateTimeSteadyNs
2024-09-08 07:26:23 +01:00

46 lines
1.5 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSTimer.NT.hpp
Date: 2022-4-19
Author: Reece
***/
#pragma once
#include "LSHandle.hpp"
namespace Aurora::IO::Loop
{
struct LSTimer : ITimer, virtual LSHandle
{
LSTimer(AuUInt32 reschedStepMsOrZero, AuUInt32 maxIterationsOrZero, bool bSingleshot, int handle);
~LSTimer();
PROXY_LOOP_LOOPSOURCE_EXT_WAIT_APIS_;
virtual void UpdateTimeWall(AuUInt64 absTimeMs) override;
virtual void UpdateTimeWallNs(AuUInt64 absTimeNs) override;
virtual void UpdateTimeSteady(AuUInt64 absTimeMs) override;
virtual void UpdateTimeSteadyNs(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 IsSignaledExt(AuUInt8 uFlags) override;
virtual bool WaitOn(AuUInt32 timeout) override;
virtual ELoopSource GetType() override;
void UpdateTimeInternal(AuUInt64 absTimeMs);
void UpdateTimeInternalSteady(AuUInt64 absTimeMs);
private:
AuUInt32 maxIterationsOrZero_ {};
AuUInt64 reschedStepNsOrZero_ {}, targetTime_ {};
AuUInt32 count_ {};
bool bSingleshot {};
bool IsSignaledNonblocking();
};
}