AuroraRuntime/Source/IO/IOWaitableIOTimer.cpp
Reece 44108a322e 2/3 of the IO update (very early implementation)
[+] TTYConsole::GetPaddingTopOfLog,GetPaddingHeadOfLog,GetPaddingTopOfLog [+ set variants]
[+] IO::IOYield()
[+] IO::IAsyncTransaction::Failed,GetOSErrorCode()
[+] IByteBufferStreamPair
[+] IIOBufferedInterceptor
[+] IIOBufferedProcessor
[+] IIOEventListener
[+] IIOPipeEventListener
[+] IIOProcessorEventListener
[+] IIOProcessorManualInvoker
[+] IIOWaitableIOLoopSource
[+] IIOWaitableIOTimer
[+] IIOWaitableItem
[+] IIOWaitableTickLimiter
[+] IOAdapterAsyncStream
[+] IOAdapterByteBuffer
[+] IOAdapterCompression
[+] IOAdapterSeeking
[*] Cleanup CpuInfo.Linux.cpp
[*] Fixup async threadpool some more
[*] LSTimer.NT.cpp updates timer object on tick state update, akin to Linux
2022-06-12 00:01:27 +01:00

97 lines
1.9 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOWaitableIOTimer.cpp
Date: 2022-6-6
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include <Aurora/IO/IOExperimental.hpp>
#include "IOWaitableIOTimer.hpp"
namespace Aurora::IO
{
IOWaitableIOTimer::IOWaitableIOTimer()
{
}
bool IOWaitableIOTimer::IsValid()
{
return bool(this->source);
}
bool IOWaitableIOTimer::IsRunOnOtherTick()
{
return {};
}
bool IOWaitableIOTimer::IsRunOnTick()
{
return {};
}
bool IOWaitableIOTimer::CanRequestTick()
{
return {};
}
void IOWaitableIOTimer::OnReportPumper(const AuSPtr<IIOProcessorManualInvoker> &iface)
{
}
bool IOWaitableIOTimer::IsRunOnSelfIO()
{
return true;
}
AuSPtr<Loop::ILoopSource> IOWaitableIOTimer::GetSelfIOSource()
{
return this->source;
}
bool IOWaitableIOTimer::IsRunOnSelfIOCheckedOnTimerTick()
{
return true;
}
bool IOWaitableIOTimer::ApplyRateLimit()
{
return false;
}
AuUInt64 IOWaitableIOTimer::SetConstantTick(AuUInt64 ns)
{
auto old = AuExchange(this->constantTickNs, ns);
this->source->UpdateTickRateIfAnyNs(ns);
return old;
}
AuUInt64 IOWaitableIOTimer::SetTargetTimeAbs(AuUInt64 ns)
{
auto old = AuExchange(this->targetTimeAbsNs, ns);
this->source->UpdateTimeNs(ns);
return old;
}
AUKN_SYM AuSPtr<IIOWaitableIOTimer> NewWaitableIOTimer()
{
auto timer = AuMakeShared<IOWaitableIOTimer>();
if (!timer)
{
SysPushErrorMem();
return {};
}
timer->source = AuLoop::NewLSTimer(0);
if (!timer->IsValid())
{
SysPushErrorMem();
return {};
}
return timer;
}
}