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;

}

相关推荐
田梓燊15 小时前
2026/4/11 leetcode 3741
数据结构·算法·leetcode
斯内科16 小时前
FFT快速傅里叶变换
算法·fft
2301_8227032016 小时前
开源鸿蒙跨平台Flutter开发:幼儿疫苗全生命周期追踪系统:基于 Flutter 的免疫接种档案与状态机设计
算法·flutter·华为·开源·harmonyos·鸿蒙
贵慜_Derek16 小时前
Managed Agents 里,Harness 到底升级了什么?
人工智能·算法·架构
2301_8227032016 小时前
鸿蒙flutter三方库实战——教育与学习平台:Flutter Markdown
学习·算法·flutter·华为·harmonyos·鸿蒙
Jia ming16 小时前
C语言实现日期天数计算
c语言·开发语言·算法
无限进步_17 小时前
【C++&string】大数相乘算法详解:从字符串加法到乘法实现
java·开发语言·c++·git·算法·github·visual studio
苏纪云17 小时前
蓝桥杯考前突击
c++·算法·蓝桥杯
W230357657317 小时前
经典算法详解:最长公共子序列 (LCS) —— 从暴力递归到动态规划完整实现
算法·动态规划·最长子序列
pzx_00117 小时前
【优化器】 随机梯度下降 SGD 详解
人工智能·python·算法