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_ = &pxReadyTasksLists4;

//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;

}

相关推荐
青山木2 小时前
Hot 100 ---腐烂的橘子
java·数据结构·后端·算法·leetcode·广度优先
未来之窗软件服务2 小时前
计算机考试-快速排序—东方仙盟
数据结构·算法·排序算法·仙盟创梦ide·东方仙盟
小龙报3 小时前
【优选算法】1. 水果成蓝 2.找到字符串中所有字母的异位词
java·c语言·数据结构·数据库·c++·redis·算法
txzrxz3 小时前
数论:排列数、组合数、费马小定理、逆元、同余定理
c++·算法·数论·组合数·费马小定理·逆元·排列数
xqqxqxxq4 小时前
LeetCode Hot100 双指针专项题解笔记
笔记·算法·leetcode
闪电悠米4 小时前
力扣hot100-54.螺旋矩阵-模拟边界控制详解
算法·leetcode·矩阵
变量未定义~4 小时前
虚拟节点-星石传送阵(4星)、强连通分量
数据结构·算法
IT方大同4 小时前
C语言分支与循环语句
c语言·开发语言·算法
待磨的钝刨5 小时前
深入理解主成分分析(PCA)
人工智能·线性代数·算法·机器学习
wWYy.6 小时前
算法:合并两个有序数组
数据结构·算法