FreeRTOS代码剖析之5:链表管理list.c

本文深入剖析FreeRTOS中的链表管理,包括xLIST_ITEM和xMINI_LIST_ITEM的区别,链表组织结构xLIST及其初始化,以及链表的插入和移除操作。通过代码和图示解释,阐述链表在FreeRTOS内核中的作用。
摘要由CSDN通过智能技术生成
    链表是操作系统中常用的数据结构,其结构比较简单,因此在剖析FreeRTOS的内核时先从这里开始入手。
    链表是由众多链表节点组成的,在FreeRTOS中,链表节点有两种定义,分别是xLIST_ITEM和xMINI_LIST_ITEM。这两种有什么区别呢?可以说,xMINI_LIST_ITEM是xLIST_ITEM的浓缩版。看看两者的定义。

struct xLIST_ITEM
{
 configLIST_VOLATILE TickType_t xItemValue;	/*< The value being listed. In most cases this is used to sort the list in descending order. */
 struct xLIST_ITEM * configLIST_VOLATILE pxNext;	/*< Pointer to the next ListItem_t in the list. */
 struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;	/*< Pointer to the previous ListItem_t in the list. */
 void * pvOwner;	 /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
 void * configLIST_VOLATILE pvContainer;	/*< Pointer to the list in which this list item is placed (if any). */
};
typedef struct xLIST_ITEM ListItem_t;	/* For some reason lint wants this as two separate definitions. */

struct xMINI_LIST_ITEM
{
 configLIST_VOLATILE TickType_t xItemValue;
 struct xLIST_ITEM * con
  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值