Changeset View
Changeset View
Standalone View
Standalone View
src/scheduler.h
Show All 39 Lines | |||||
public: | public: | ||||
CScheduler(); | CScheduler(); | ||||
~CScheduler(); | ~CScheduler(); | ||||
typedef std::function<void(void)> Function; | typedef std::function<void(void)> Function; | ||||
typedef std::function<bool(void)> Predicate; | typedef std::function<bool(void)> Predicate; | ||||
// Call func at/after time t | // Call func at/after time t | ||||
void schedule(Function f, | void schedule(Function f, boost::chrono::system_clock::time_point t = | ||||
boost::chrono::system_clock::time_point t = | |||||
boost::chrono::system_clock::now()); | boost::chrono::system_clock::now()); | ||||
// Convenience method: call f once deltaMilliSeconds from now | // Convenience method: call f once deltaMilliSeconds from now | ||||
void scheduleFromNow(Function f, int64_t deltaMilliSeconds); | void scheduleFromNow(Function f, int64_t deltaMilliSeconds); | ||||
// Another convenience method: call f approximately every deltaMilliSeconds | // Another convenience method: call f approximately every deltaMilliSeconds | ||||
// forever, starting deltaMilliSeconds from now. To be more precise: every | // forever, starting deltaMilliSeconds from now. To be more precise: every | ||||
// time f is finished, it is rescheduled to run deltaMilliSeconds later. If | // time f is finished, it is rescheduled to run deltaMilliSeconds later. If | ||||
// you need more accurate scheduling, don't use this method. | // you need more accurate scheduling, don't use this method. | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |