当前位置:网站首页>1287_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
1287_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
2022-07-02 06:51:00 【grey_csdn】
全部学习汇总: GreyZhang/g_FreeRTOS: learning notes about FreeRTOS. (github.com)
这一次看一下prvTaskIsTaskSuspended()的接口,这个接口实现的是判断一个task是否是挂起的状态。通常,这种判断类的接口实现简单一些。类似之前获取任务优先级的实现,也是如此。因为本身的功能是查询而不是修改,对OS整体的运行环境没有太大的影响。

很多接口的实现中,任务句柄如果为NULL默认就是处理当前的任务。但是在这个接口中这种解释没有意义,因为任务只要是在执行查询的动作说明当前的任务并没有被挂起。

这是接口实现的主要部分,做了一个简单的注释说明。查询实现比较简单,首先判断任务是否在挂起任务的链表当中。如果不在,直接不需要查询了,肯定不是挂起的任务。那么在就一定是挂起的任务吗?其实也不然。
这个接口实现的查询,其实是实现了任务不执行的挂起状态是否是由挂起动作触发的。如果是阻塞导致的挂起,也不应该作为挂起状态返回。由此,判断的就不仅仅是一个链表元素的归属状态了,还得看一下事件状态是否有效,因为事件状态表征的是任务因为非挂起动作导致的不执行而进入挂起链表。
有了上面的规则之后,判断出的结果作为返回结果返回即可。
边栏推荐
- [tutorial] how to make the Helpviewer help document of VisualStudio run independently
- session-cookie与token
- Introduction and Principle notes of UE4 material
- How to get the password of cpolar?
- Blender camera surround motion, animation rendering, video synthesis
- Sum the two numbers to find the target value
- pytest框架实现前后置
- Lunix reallocates root and home space memory
- 使用Windbg静态分析dump文件(实战经验总结)
- ERROR 1118 (42000): Row size too large (> 8126)
猜你喜欢
随机推荐
【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
Retrofit's callback hell is really vulnerable in kotlin synergy mode!
Sus system availability scale
对话吴纲:我为什么笃信“大国品牌”的崛起?
Delivery mode design of Spartacus UI of SAP e-commerce cloud
Shutter - canvas custom graph
《MySQL 8 DBA基础教程》简介
简洁、快速、节约内存的Excel处理工具EasyExcel
shell编程01_Shell基础
【Unity3D】无法正确获取RectTransform的属性值导致计算出错
【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
13.信号量临界区保护
[Fantasy 4] introduction and use of UMG components (under update...)
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
从MediaRecord录像中读取H264参数
Deep understanding of redis cache avalanche / cache breakdown / cache penetration
[leetcode] sword finger offer 53 - I. find the number I in the sorted array
Sum the two numbers to find the target value
两数之和,求目标值









