16 #ifndef BM_BM_SIM_PERIODIC_TASK_H_
17 #define BM_BM_SIM_PERIODIC_TASK_H_
26 #include <condition_variable>
61 std::function<
void()> fn,
62 std::chrono::milliseconds interval);
72 const std::string name;
73 const std::chrono::milliseconds interval;
83 const std::function<void()> fn;
84 std::chrono::system_clock::time_point next;
103 class PeriodCompare {
107 return lhs->next > rhs->next;
111 std::vector<PeriodicTask*>,
120 TaskQueue task_queue;
122 std::thread periodic_thread;
124 mutable std::mutex queue_mutex;
125 mutable std::condition_variable cv;
130 #endif // BM_BM_SIM_PERIODIC_TASK_H_