|
GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
|
异步任务上下文类。 更多...
#include <async.hpp>


类 | |
| struct | info_type |
Public 类型 | |
| using | task_type = awaitable<> |
| using | shutdown_handler_type = std::function< task_type()> |
Public 成员函数 | |
| void | spawn (task_type &&task) |
| 添加一个协程任务到上下文中执行。 | |
| template<typename Fn , typename... Args> | |
| void | post (Fn &&fn, Args &&... args) |
| 添加一个任务到上下文中执行。 | |
| void | set_shutdown_handler (shutdown_handler_type handler) |
| 注册异常或外部请求共用的一次性安全停机任务。 | |
| void | request_shutdown () noexcept |
| 请求一次安全停机。 | |
| void | run () noexcept |
| 开始运行任务上下文。 | |
| void | stop () |
| bool | failed () const noexcept |
| 是否观察到过未处理的异步异常。 | |
| bool | shutdown_requested () const noexcept |
| 是否已经进入一次性停机流程。 | |
| bool | init (info_type _info) |
| 初始化 task_context | |
| std::string | desc () const |
| task_context的描述 | |
| auto | get_executor () |
| 获取asio的executor。 | |
| auto | asio_context () -> asio::io_context & |
| 获取asio的io_context。 | |
Public 成员函数 继承自 roboctrl::utils::singleton_base< task_context > | |
| singleton_base (const singleton_base &)=delete | |
| singleton_base & | operator= (const singleton_base &)=delete |
Public 成员函数 继承自 roboctrl::utils::immovable_base | |
| immovable_base (immovable_base &&)=delete | |
| immovable_base & | operator= (immovable_base &&)=delete |
Public 成员函数 继承自 roboctrl::utils::not_copyable_base | |
| not_copyable_base (const not_copyable_base &)=delete | |
| not_copyable_base & | operator= (const not_copyable_base &)=delete |
额外继承的成员函数 | |
静态 Public 成员函数 继承自 roboctrl::utils::singleton_base< task_context > | |
| static task_context & | instance () |
| 获取单例实例 | |
Protected 成员函数 继承自 roboctrl::log::logable< task_context > | |
| void | log (log_level level, std::format_string< Args... > fmt, Args &&...args) const |
| 输出日志 | |
| void | log_debug (std::format_string< Args... > fmt, Args &&...args) const |
| 输出debug日志 | |
| void | log_info (std::format_string< Args... > fmt, Args &&...args) const |
| 输出info日志 | |
| void | log_warn (std::format_string< Args... > fmt, Args &&...args) const |
| 输出warn日志 | |
| void | log_error (std::format_string< Args... > fmt, Args &&...args) const |
| 输出error日志 | |
| using roboctrl::async::task_context::shutdown_handler_type = std::function<task_type()> |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
| bool task_context::init | ( | task_context::info_type | _info | ) |
初始化 task_context
|
inline |
添加一个任务到上下文中执行。
| Fn | 任务类型 |
| Args | 任务参数类型 |
| fn | 任务 |
| args | 任务参数 |
示例:
|
noexcept |
|
noexcept |
| void task_context::set_shutdown_handler | ( | shutdown_handler_type | handler | ) |
|
inlinenoexcept |
| void task_context::spawn | ( | task_context::task_type && | task | ) |
添加一个协程任务到上下文中执行。
| task | 任务 |
示例: