24 #include <condition_variable>
32 template<
class Signature,
class Function = std::function<Signature>>
34 typedef std::chrono::system_clock TimerClock;
47 std::unique_lock<std::mutex> timerLock(
timerGuard_);
58 void start(std::size_t seconds,
const Function& callback)
61 throw KaaException(
"Bad timer callback");
63 std::unique_lock<std::mutex> timerLock(
timerGuard_);
71 endTS_ = TimerClock::now() + std::chrono::seconds(seconds);
80 std::unique_lock<std::mutex> timerLock(
timerGuard_);
91 std::unique_lock<std::mutex> timerLock(
timerGuard_);
95 auto now = TimerClock::now();
116 const std::string timerName_;
126 std::chrono::time_point<TimerClock>
endTS_;
KaaTimer(const std::string &timerName)
std::condition_variable condition_
std::chrono::time_point< TimerClock > endTS_