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;

}

相关推荐
I_LPL2 小时前
hot100贪心专题
数据结构·算法·leetcode·贪心
颜酱3 小时前
DFS 岛屿系列题全解析
javascript·后端·算法
WolfGang0073213 小时前
代码随想录算法训练营 Day16 | 二叉树 part06
算法
2401_831824964 小时前
代码性能剖析工具
开发语言·c++·算法
Sunshine for you5 小时前
C++中的职责链模式实战
开发语言·c++·算法
qq_416018725 小时前
C++中的状态模式
开发语言·c++·算法
2401_884563245 小时前
模板代码生成工具
开发语言·c++·算法
2401_831920746 小时前
C++代码国际化支持
开发语言·c++·算法
m0_672703316 小时前
上机练习第51天
数据结构·c++·算法
ArturiaZ6 小时前
【day60】
算法·深度优先·图论