/***
Copyright (C) 2021-2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSTimer.cpp
Date: 2021-10-1 - 2024-09-08
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
namespace Aurora::IO::Loop
{
AuSPtr<ITimer> NewLSTimerOS(AuUInt64 qwAbsStartTimeMs, AuUInt32 dwReschedStepMsOrZero, AuUInt32 dwMaxIterationsOrZero, bool bSingleshot, bool bIsStartTimeSteady);
AuSPtr<ITimer> NewLSTimerIP(AuUInt64 qwAbsStartTimeMs, AuUInt32 dwReschedStepMsOrZero, AuUInt32 dwMaxIterationsOrZero, bool bSingleshot, bool bIsStartTimeSteady);
#if defined(AURORA_IS_MODERNNT_DERIVED)
AuSPtr<ITimer> NewLSTimerOSHiRes(AuUInt64 absStartTimeMs, AuUInt32 reschedStepMsOrZero, AuUInt32 maxIterationsOrZero, bool bSingleshot, bool bIsStartTimeSteady);
#endif
static bool MustUseAltTimer()
return gRuntimeConfig.ioConfig.bForceAltOSTimerPrimitives;
}
static bool IsHPInProcess()
return true;
#else
return !gRuntimeConfig.ioConfig.bTrustOSTimerPrimitiveIfKnownGood;
AUKN_SYM AuSPtr<ITimer> NewLSTimerHighResolution(AuUInt64 qwAbsStartTimeMs, AuUInt32 dwReschedStepMsOrZero, AuUInt32 dwMaxIterationsOrZero, bool bSingleshot, bool bIsStartTimeSteady)
if (auto pHighResIO = NewLSTimerOSHiRes(qwAbsStartTimeMs, dwReschedStepMsOrZero, dwMaxIterationsOrZero, bSingleshot, bIsStartTimeSteady))
return pHighResIO;
if (IsHPInProcess())
return NewLSTimerIP(qwAbsStartTimeMs, dwReschedStepMsOrZero, dwMaxIterationsOrZero, bSingleshot, bIsStartTimeSteady);
else
return NewLSTimerOS(qwAbsStartTimeMs, dwReschedStepMsOrZero, dwMaxIterationsOrZero, bSingleshot, bIsStartTimeSteady);
AUKN_SYM AuSPtr<ITimer> NewLSTimer(AuUInt64 qwAbsStartTimeMs, AuUInt32 dwReschedStepMsOrZero, AuUInt32 dwMaxIterationsOrZero, bool bSingleshot, bool bIsStartTimeSteady)
if (MustUseAltTimer())