8#ifndef GALAXY_TIME_TIMER_HPP_
9#define GALAXY_TIME_TIMER_HPP_
24 using Function = std::move_only_function<void(
void)>;
49 void start(const
bool repeat = false);
77 bool paused() const noexcept;
Asynchronous timer class.
std::atomic_bool m_started
Has the timer been started.
void stop() noexcept
Stop timer.
std::future< void > m_handle
Thread running task.
std::atomic_bool m_repeat
Is timer looping.
Timer() noexcept
Constructor.
Timer::Function m_callback
Callback function.
void pause(const bool pause) noexcept
Pause the timer.
void start(const bool repeat=false)
Start timer.
std::atomic_bool m_paused
Is timer paused.
bool paused() const noexcept
Is the timer paused?
std::move_only_function< void(void)> Function
Timer callback type.
void set(Timer::Function &&func, const std::uint64_t delay) noexcept
Run a function on a precision timer.
std::uint64_t m_delay
Current delay on timer.
bool stopped() const noexcept
Is the timer finished?