8#ifndef GALAXY_ASYNC_TIMER_HPP_
9#define GALAXY_ASYNC_TIMER_HPP_
27 using Function = std::move_only_function<void(
void)>;
93 bool paused() const noexcept;
Asynchronous timer class.
void set(Timer::Function &&func, const std::uint32_t delay) noexcept
Run a function on a precision timer.
std::uint32_t m_delay
Current delay on timer.
void stop() noexcept
Stop timer.
void repeat(const bool repeat) noexcept
Make function repeat itself instead of running once.
bool paused() const noexcept
Is the timer paused?
Timer() noexcept
Constructor.
double m_time_passed
Time passed.
std::atomic_bool m_stopped
Is timer stopped.
Timer::Function m_callback
Callback function.
std::atomic_bool m_paused
Is timer paused.
std::future< void > m_handle
Thread running task.
void pause(const bool pause) noexcept
Pause the timer.
std::move_only_function< void(void)> Function
Timer callback type.
std::atomic_bool m_repeat
Is function repeating?
bool stopped() const noexcept
Is the timer finished?