64 template<
typename F,
typename... Args>
65 Timer(
const std::chrono::milliseconds &timeout, F f, Args&&... args)
67 start(timeout, TimerType::OneRun, TimerThreadPriority::Default, std::bind(f, args...));
70 template<
typename F,
typename... Args>
71 Timer(
const std::chrono::milliseconds &timeout, TimerType type, TimerThreadPriority prio, F f, Args&&... args)
73 start(timeout, type, prio, std::bind(f, args...));
76 Timer(Timer&& other) =
delete;
77 Timer(
const Timer&) =
delete;
79 Timer& operator=(Timer&& other) =
delete;
80 Timer& operator=(
const Timer& other) =
delete;
97 void start(
const std::chrono::milliseconds &timeout, TimerType type, TimerThreadPriority prio,
const std::function<
void()> &callback);
99 void singleShotTimer(TimerThreadPriority prio,
const std::chrono::steady_clock::time_point &deadline);
100 void recurringTimer(TimerThreadPriority prio,
const std::chrono::milliseconds &interval);
103 std::function<void()> mCallback;
105 std::thread mTimerThread;
107 ConditionVariable mCond;
Timer(const std::chrono::milliseconds &timeout, F f, Args &&... args)
Starts a timer that will expire after timeout and execute action.
Definition Timer.h:65