|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
同步驱动操作的阻塞等待器 / Blocking waiter for synchronous driver operations. More...
#include <operation.hpp>
Public Types | |
| enum class | State : uint32_t { IDLE = 0 , PENDING = 1 , CLAIMED = 2 , DETACHED = 3 } |
| 32 位等待状态,兼容 STM32 原子适配 / 32-bit wait state for STM32 atomic support. More... | |
Public Member Functions | |
| void | Start (Semaphore &sem) |
| 绑定信号量并开始等待 / Bind a semaphore and start waiting. | |
| void | Cancel () |
| 清除等待状态,不发送通知 / Clear the wait state without posting. | |
| ErrorCode | Wait (uint32_t timeout) |
| 等待完成或超时交接 / Wait for completion or a timeout handoff. | |
| bool | TryPost (bool in_isr, ErrorCode ec) |
| 尝试认领完成并唤醒调用者 / Try to claim completion and wake the caller. | |
同步驱动操作的阻塞等待器 / Blocking waiter for synchronous driver operations.
超时解除调用者的等待,迟到的完成只清退状态,不再唤醒已超时的调用者。 Timeout detaches the caller. A late completion clears the state without waking it.
Definition at line 169 of file operation.hpp.
|
strong |
32 位等待状态,兼容 STM32 原子适配 / 32-bit wait state for STM32 atomic support.
| Enumerator | |
|---|---|
| IDLE | 无等待 / No wait. |
| PENDING | 等待完成 / Awaiting completion. |
| CLAIMED | 完成方已认领通知 / Completion notification claimed. |
| DETACHED | 调用者已超时 / Caller timed out. |
Definition at line 173 of file operation.hpp.
|
inline |
清除等待状态,不发送通知 / Clear the wait state without posting.
Definition at line 193 of file operation.hpp.
|
inline |
绑定信号量并开始等待 / Bind a semaphore and start waiting.
| sem | 本次等待使用的信号量 / Semaphore for this wait. |
Definition at line 185 of file operation.hpp.
|
inline |
尝试认领完成并唤醒调用者 / Try to claim completion and wake the caller.
| in_isr | 当前是否在中断中 / Whether called in an ISR. |
| ec | 完成结果 / Completion result. |
Definition at line 250 of file operation.hpp.
|
inline |
等待完成或超时交接 / Wait for completion or a timeout handoff.
| timeout | 传给信号量的超时值 / Timeout passed to the semaphore. |
Definition at line 202 of file operation.hpp.