4#ifndef RESOURCE_TUNER_TIMER_H
5#define RESOURCE_TUNER_TIMER_H
12#include <condition_variable>
26 std::mutex mTimerMutex;
29 void implementTimer();
44 Timer(std::function<
void(
void*)> callBack, int8_t isRecurring=
false);
int64_t mDuration
Duration of the timer.
std::condition_variable mTimerCond
Condition variable to stop the thread for the timer duration and wake up either after the duration ha...
std::function< void(void *)> mCallback
Callback function to be called after timer is over.
void killTimer()
Invalidates current timer.
int8_t startTimer(int64_t duration)
Starts the timer for the given duration in milliseconds.
std::atomic< int8_t > mTimerStop
Flag to let the timer thread know it has been killed.
int8_t mIsRecurring
Flag to set a recurring timer. It is never modified. False by default.
Timer(std::function< void(void *)> callBack, int8_t isRecurring=false)
Initialize the Timer.