物联网操作系统AliOS Things 3.3
消息队列

类型定义

typedef aos_hdl_t aos_queue_t
 

函数

aos_status_t aos_queue_create (aos_queue_t *queue, size_t size, size_t max_msg, uint32_t options)
 
void aos_queue_free (aos_queue_t *queue)
 
aos_status_t aos_queue_send (aos_queue_t *queue, void *msg, size_t size)
 
aos_status_t aos_queue_recv (aos_queue_t *queue, uint32_t ms, void *msg, size_t *size)
 
aos_status_t aos_queue_get_count (aos_queue_t *queue)
 

详细描述

提供AliOS Things系统内核消息队列功能的基础API.

类型定义说明

◆ aos_queue_t

AOS消息队列对象句柄类型

在文件 kernel.h138 行定义.

函数说明

◆ aos_queue_create()

aos_status_t aos_queue_create(aos_queue_tqueue,
size_t size,
size_t max_msg,
uint32_t options 
)

This function will create a queue.

参数
[in]queuepointer to the queue(the space is provided by user).
[in]sizethe bytes of the buf.
[in]max_msgthe max size of the msg.
[in]optionsreserved.
返回
0: success.

◆ aos_queue_free()

void aos_queue_free(aos_queue_tqueue)

This function will delete a queue.

参数
[in]queuepointer to the queue.

◆ aos_queue_get_count()

aos_status_t aos_queue_get_count(aos_queue_tqueue)

Get number of queued messages in a message queue.

参数
[in]queuemessage queue handle to operate.
返回
number of queued messages.negative indicates error code.

◆ aos_queue_recv()

aos_status_t aos_queue_recv(aos_queue_tqueue,
uint32_t ms,
void * msg,
size_t * size 
)

This function will receive msg from a queue.

参数
[in]queuepointer to the queue.
[in]msms to wait before receive.
[out]msgbuf to save msg.
[out]sizesize of the msg.
返回
0: success.

◆ aos_queue_send()

aos_status_t aos_queue_send(aos_queue_tqueue,
void * msg,
size_t size 
)

This function will send a msg to the front of a queue.

参数
[in]queuepointer to the queue.
[in]msgmsg to send.
[in]sizesize of the msg.
返回
0: success.