libxr
1.0
Want to be the best embedded framework
|
线程安全的锁队列类,提供同步和异步操作支持 Thread-safe lock queue class with synchronous and asynchronous operation support More...
#include <lock_queue.hpp>
Public Member Functions | |
LockQueue (size_t length) | |
构造函数,初始化队列 Constructor to initialize the queue | |
~LockQueue () | |
析构函数,释放资源 Destructor to release resources | |
ErrorCode | Push (const Data &data) |
向队列中推送数据 Pushes data into the queue | |
ErrorCode | Pop (Data &data, uint32_t timeout) |
从队列中弹出数据(带超时) Pops data from the queue with timeout | |
ErrorCode | Pop () |
无参数弹出数据 Pops data from the queue without storing it | |
ErrorCode | Pop (uint32_t timeout) |
带超时的弹出数据 Pops data from the queue with timeout | |
ErrorCode | PushFromCallback (const Data &data, bool in_isr) |
从回调函数中推送数据 Pushes data into the queue from a callback function | |
size_t | Size () |
获取队列中的数据项数量 Gets the number of items in the queue | |
size_t | EmptySize () |
获取队列的剩余容量 Gets the remaining capacity of the queue | |
Private Attributes | |
Queue< Data > | queue_handle_ |
底层队列对象 Underlying queue object | |
Mutex | mutex_ |
互斥锁 Mutex for thread safety | |
Semaphore | semaphore_handle_ |
信号量 Semaphore for synchronization | |
线程安全的锁队列类,提供同步和异步操作支持 Thread-safe lock queue class with synchronous and asynchronous operation support
Data | 队列存储的数据类型 The type of data stored in the queue |
Definition at line 20 of file lock_queue.hpp.
|
inline |
构造函数,初始化队列 Constructor to initialize the queue
length | 队列的最大长度 Maximum length of the queue |
Definition at line 28 of file lock_queue.hpp.
|
inline |
|
inline |
获取队列的剩余容量 Gets the remaining capacity of the queue
Definition at line 141 of file lock_queue.hpp.
|
inline |
无参数弹出数据 Pops data from the queue without storing it
Definition at line 81 of file lock_queue.hpp.
|
inline |
从队列中弹出数据(带超时) Pops data from the queue with timeout
data | 存储弹出数据的变量 Variable to store the popped data |
timeout | 超时时间(毫秒) Timeout in milliseconds |
Definition at line 61 of file lock_queue.hpp.
|
inline |
带超时的弹出数据 Pops data from the queue with timeout
timeout | 超时时间(毫秒) Timeout in milliseconds |
Definition at line 95 of file lock_queue.hpp.
|
inline |
向队列中推送数据 Pushes data into the queue
data | 要推送的数据 The data to be pushed |
Definition at line 42 of file lock_queue.hpp.
|
inline |
从回调函数中推送数据 Pushes data into the queue from a callback function
data | 要推送的数据 The data to be pushed |
in_isr | 是否在中断上下文中 Whether the function is called from an ISR |
Definition at line 117 of file lock_queue.hpp.
|
inline |
获取队列中的数据项数量 Gets the number of items in the queue
Definition at line 128 of file lock_queue.hpp.
|
private |
互斥锁 Mutex for thread safety
Definition at line 151 of file lock_queue.hpp.
|
private |
底层队列对象 Underlying queue object
Definition at line 150 of file lock_queue.hpp.
|
private |
信号量 Semaphore for synchronization
Definition at line 152 of file lock_queue.hpp.