|
DISPENSO_DLL_ACCESS | TimedTaskScheduler (ThreadPriority priority=ThreadPriority::kNormal) |
|
void | setPriority (ThreadPriority priority) |
|
template<typename Schedulable , typename F > |
TimedTask | schedule (Schedulable &sched, F &&func, double nextRunAbs, double period=0.0, size_t timesToRun=1, TimedTaskType type=TimedTaskType::kNormal) |
|
template<typename Schedulable , typename Rep , typename Period , typename F > |
TimedTask | schedule (Schedulable &sched, F &&func, const std::chrono::duration< Rep, Period > &timeInFuture) |
|
template<typename Schedulable , typename Clock , typename Duration , typename F > |
TimedTask | schedule (Schedulable &sched, F &&func, const std::chrono::time_point< Clock, Duration > &nextRunTime) |
|
template<typename Schedulable , typename Rep , typename Period , typename F > |
TimedTask | schedule (Schedulable &sched, F &&func, const std::chrono::duration< Rep, Period > &timeInFuture, const std::chrono::duration< Rep, Period > &period, size_t timesToRun=std::numeric_limits< size_t >::max(), TimedTaskType type=TimedTaskType::kNormal) |
|
template<typename Schedulable , typename Rep , typename Period , typename Clock , typename Duration , typename F > |
TimedTask | schedule (Schedulable &sched, F &&func, const std::chrono::time_point< Clock, Duration > &nextRunTime, const std::chrono::duration< Rep, Period > &period, size_t timesToRun=std::numeric_limits< size_t >::max(), TimedTaskType type=TimedTaskType::kNormal) |
|
A timed-task scheduler running on a single thread. This allows multiple schedulers if necessary, if e.g. you wish to schedule against InlineInvoker backing schedulable and you're running a lot of relatively quick timed tasks.Most people should just use the global timed task scheduler.
Definition at line 126 of file timed_task.h.
template<typename Schedulable , typename Rep , typename Period , typename Clock , typename Duration , typename F >
TimedTask dispenso::TimedTaskScheduler::schedule |
( |
Schedulable & | sched, |
|
|
F && | func, |
|
|
const std::chrono::time_point< Clock, Duration > & | nextRunTime, |
|
|
const std::chrono::duration< Rep, Period > & | period, |
|
|
size_t | timesToRun = std::numeric_limits<size_t>::max(), |
|
|
TimedTaskType | type = TimedTaskType::kNormal ) |
|
inline |
Schedule a task to run periodically
- Parameters
-
sched | A backing schedulable, such as ImmediateInvoker, NewThreadInvoker, TaskSet, or ThreadPool to run the function in when it is scheduled. |
func | A bool() function to run when scheduled. The function may return true to indicate it should continue to be scheduled, or false to cancel. |
nextRunTime | An absolute time to run the function. If in the past, func will run immediately. |
period | The period defining the run frequency |
timesToRun | The number of times to run the function. After that number, the function will not be called again. |
type | The type of periodicity (if any). |
Definition at line 254 of file timed_task.h.