嵌入式操作系统内核原理和开发(消息队列).pdfVIP

  • 1
  • 0
  • 约1.62万字
  • 约 16页
  • 2020-11-14 发布于四川
  • 举报

嵌入式操作系统内核原理和开发(消息队列).pdf

嵌入式操作系统内核原理和开 发( 消息队列 ) 嵌入式操作系统内核原理和开发(消息队列) 消息队列是线程交互的一种方法, 任务可以通过 消息队列来实现数据的沟通和交换。 在嵌入式系 统上,这可以说这是用的最多的一种方法。 通过 消息队列, 无论是发送者, 还是接受者都可以循 环地处理各种消息。 而我们知道, 存储消息最好 的方式就是循环队列, 如果消息已满, 那么发送 者可以把自己 pend 到等待队列上; 而如果此时 没有消息, 那么接受者也可以把自己 pend 到等 待队列上。 当然实现消息队列的方法很多, 甚至 用户可以自己利用互斥量和信号量来实现, 而嵌 入式系统常常会默认提供这样的功能函数, 我想 主要的目的还是为了方便用户, 让他们可以更多 地从业务的角度来看问题, 而不是把重点关注在 这些底层的细节上面。 首先,我们还是看看 rawos 上面关于消 息队列的数据结构是怎么定义的, typedef struct RAW_MSG_Q { RAW_VOID **queue_start; /* Pointer to start of queue data */ RAW_VOID **queue_end; /* Pointer to end of queue data */ 软件英才网 软件行业驰名招聘网站 RAW_VOID **write; /* Pointer to where next message will be inserted in the Q */ RAW_VOID **read; /* Pointer to where next message will be extracted from the Q */ RAW_U32 size; /* Size of queue (maximum number of entries) */ RAW_U32 current_numbers; /* Current number of entries in the queue */ RAW_U16 blocked_send_task_numbers; /*number of blocked send task numbers */ RAW_U16 blocked_receive_task_numbers; /*number of blocked send task numbers */ } RAW_MSG_Q; typedef struct RAW_QUEUE { RAW_COMMON_BLOCK_OBJECT common_block_obj;

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档