|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
定时任务调度器 更多...
#include <timer.hpp>
Public 类型 | |
| using | clock_type = Clock |
| 时钟类型 | |
| using | time_point = typename clock_type::time_point |
| 时间点类型 | |
| using | duration = typename clock_type::duration |
| 时长类型 | |
| using | token = size_t |
| 任务标识符类型 | |
| using | handler_type = function<void()> |
| 回调函数类型 | |
Public 成员函数 | |
| timer_scheduler () | |
| 构造函数,启动调度线程 | |
| ~timer_scheduler () | |
| 析构函数,停止调度线程并等待其结束 | |
| token | add_task (time_point expire, handler_type &&handler) |
| 添加定时任务 | |
| bool | cancel (token id) |
| 取消定时任务 | |
| void | cancel_all () |
| 取消所有定时任务 | |
| NEFORCE_NODISCARD size_t | size () const |
| 获取当前待处理的任务数量 | |
定时任务调度器
| Clock | 时钟类型 |
管理所有定时任务的调度和执行。使用独立的线程运行调度循环, 基于时间点对任务进行排序,并在任务到期时执行回调函数。
|
inline |
|
inline |
|
inline |