RT-Thread API参考手册  3.1.1
嵌入式实时操作系统
等待队列

等待队列接口 更多...

结构体

struct  rt_wqueue
 等待队列控制块 更多...
 
struct  rt_wqueue_node
 等待队列节点 更多...
 

宏定义

#define RT_WQ_FLAG_CLEAN   0x00
 等待队列清除
 
#define RT_WQ_FLAG_WAKEUP   0x01
 等待队列唤醒
 
#define DEFINE_WAIT_FUNC(name, function)
 定义等待队列 更多...
 

类型定义

typedef struct rt_wqueue rt_wqueue_t
 等待队列类型指针定义
 
typedef int(* rt_wqueue_func_t) (struct rt_wqueue_node *wait, void *key)
 等待队列回调函数类型定义
 
typedef struct rt_wqueue_node rt_wqueue_node_t
 等待队列类型定义
 

函数

int rt_wqueue_wait (rt_wqueue_t *queue, int condition, int timeout)
 加入等待队列 更多...
 
void rt_wqueue_wakeup (rt_wqueue_t *queue, void *key)
 唤醒等待队列 更多...
 

详细描述

等待队列接口

宏定义说明

#define DEFINE_WAIT_FUNC (   name,
  function 
)
值:
struct rt_wqueue_node name = { \
rt_current_thread, \
\
function, \
0 \
}

定义等待队列

参数
name等待队列名称
function等待队列唤醒条件判断函数,由客户定义

函数说明

int rt_wqueue_wait ( rt_wqueue_t queue,
int  condition,
int  timeout 
)

加入等待队列

在指定等待队列上挂起等待或超时返回。

参数
queue等待队列句柄
condition与POSIX 标准接口兼容的参数(目前没有意义,传入0即可)。
timeout指定的等待时间。
返回
0 加入成功
void rt_wqueue_wakeup ( rt_wqueue_t queue,
void *  key 
)

唤醒等待队列

唤醒指定等待队列上符合条件的被挂起的线程。

参数
queue等待队列句柄
key唤醒条件