libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
async.cpp
1#include "async.hpp"
2#include "libxr_def.hpp"
3#include "thread.hpp"
4
5using namespace LibXR;
6
8 UNUSED(stack_depth);
9 UNUSED(priority);
10}
11
12ErrorCode ASync::AssignJob(Callback job) {
13 if (status_ == Status::BUSY) {
14 return ErrorCode::BUSY;
15 }
16
18
19 job.Run(false, this);
20 return ErrorCode::OK;
21}
Status status_
当前异步任务状态。 The current status of the asynchronous task.
Definition async.hpp:69
@ BUSY
任务正在执行中。 Task is currently running.
ASync(size_t stack_depth, Thread::Priority priority)
构造 ASync 对象并初始化任务线程。 Constructs an ASync object and initializes the task thread.
Definition async.cpp:7
ErrorCode AssignJob(Callback job)
分配一个异步任务并准备执行。 Assigns an asynchronous job and prepares for execution.
Definition async.cpp:11
提供一个通用的回调包装,支持动态参数传递。 Provides a generic callback wrapper, supporting dynamic argument passing.
Definition libxr_cb.hpp:125
Priority
线程优先级枚举 Enumeration for thread priorities
Definition thread.hpp:22
LibXR Color Control Library / LibXR终端颜色控制库
Definition esp_gpio.hpp:8
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值