freertos关键函数理解 uxListRemove

//删除pxItemToRemove节点

UBaseType_t uxListRemove(ListItem_t *pxItemToRemove)

{

//The list item knows which list it is in. Obtain the list from the list item.

//找到节点所在的链表

//my_printf( "uxListRemove pxItemToRemove = %#p\n", pxItemToRemove );

List_t *pxList = pxItemToRemove->pxContainer;

List_t *pxList_; //指向目标优先级的就绪任务列表 (通过TCB的优先级索引)

//pxList_ = &pxReadyTasksLists[4];

//my_printf( "pxList = %#p\n", pxList );

//my_printf( "pxList->uxNumberOfItems = %d\n", pxList->uxNumberOfItems );

//my_printf( "&pxList->uxNumberOfItems = %#p\n", &pxList->uxNumberOfItems );

//my_printf( "pxList->pxIndex = %#p\n", pxList->pxIndex );

//my_printf( "&pxList->pxIndex = %#p\n", &pxList->pxIndex );

//my_printf( "pxList->pxIndex->pvOwner = %#p\n", pxList->pxIndex->pvOwner );

//my_printf( "pxList->pxIndex->pxContainer = %#p\n", pxList->pxIndex->pxContainer );

//|------->volatile UBaseType_t uxNumberOfItems = 1 0x20000088 链表中元素的个数

//| |<-----ListItem_t *pxIndex; 0x2000008c 总是指向xListEnd节点,在链表尾部插入的时候,方便找到位置

//| | |-->TickType_t xItemValue = portMAX_DELAY 0x20000090 [MiniListItem_t xListEnd]

//| | | struct xLIST_ITEM *pxNext; ----->| 0x20000094 后继节点

//| | | struct xLIST_ITEM *pxPrevious; ----->| 0x20000098 前驱节点

//| | | |

//| |--|-->TickType_t xItemValue; <-------------| 0x200004ac 链表节点的值

//| |<--struct xLIST_ITEM *pxNext; 后继节点

//| |<--struct xLIST_ITEM *pxPrevious; 前驱节点

//| void *pvOwner; 0x200004a8 保存私有数据 [ &TCB ]

//|<------ struct xLIST *pxContainer; 0x20000088 节点所在的链表 [ &pxReadyTasksLists[x] ]

pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;

pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;

//Make sure the index is left pointing to a valid item.

if( pxList->pxIndex == pxItemToRemove ){

pxList->pxIndex = pxItemToRemove->pxPrevious;

}

pxItemToRemove->pxContainer = NULL;

pxList->uxNumberOfItems--;

// volatile UBaseType_t uxNumberOfItems = 0 0x20000088 链表中元素的个数

// |<-----ListItem_t *pxIndex; 0x2000008c 总是指向xListEnd节点,在链表尾部插入的时候,方便找到位置

// |->|-->TickType_t xItemValue = portMAX_DELAY 0x20000090 [MiniListItem_t xListEnd]

// |<--struct xLIST_ITEM *pxNext; 0x20000094 后继节点

// |<--struct xLIST_ITEM *pxPrevious; 0x20000098 前驱节点

//返回剩余节点数

return pxList->uxNumberOfItems;

}

相关推荐
LYFlied7 小时前
【每日算法】LeetCode 153. 寻找旋转排序数组中的最小值
数据结构·算法·leetcode·面试·职场和发展
唐装鼠7 小时前
rust自动调用Deref(deepseek)
开发语言·算法·rust
ytttr8738 小时前
MATLAB基于LDA的人脸识别算法实现(ORL数据库)
数据库·算法·matlab
jianfeng_zhu10 小时前
整数数组匹配
数据结构·c++·算法
smj2302_7968265210 小时前
解决leetcode第3782题交替删除操作后最后剩下的整数
python·算法·leetcode
LYFlied11 小时前
【每日算法】LeetCode 136. 只出现一次的数字
前端·算法·leetcode·面试·职场和发展
唯唯qwe-11 小时前
Day23:动态规划 | 爬楼梯,不同路径,拆分
算法·leetcode·动态规划
做科研的周师兄11 小时前
中国土壤有机质数据集
人工智能·算法·机器学习·分类·数据挖掘
来深圳12 小时前
leetcode 739. 每日温度
java·算法·leetcode
yaoh.wang12 小时前
力扣(LeetCode) 104: 二叉树的最大深度 - 解法思路
python·程序人生·算法·leetcode·面试·职场和发展·跳槽