当前位置:网站首页>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默认就是处理当前的任务。但是在这个接口中这种解释没有意义,因为任务只要是在执行查询的动作说明当前的任务并没有被挂起。

这是接口实现的主要部分,做了一个简单的注释说明。查询实现比较简单,首先判断任务是否在挂起任务的链表当中。如果不在,直接不需要查询了,肯定不是挂起的任务。那么在就一定是挂起的任务吗?其实也不然。
这个接口实现的查询,其实是实现了任务不执行的挂起状态是否是由挂起动作触发的。如果是阻塞导致的挂起,也不应该作为挂起状态返回。由此,判断的就不仅仅是一个链表元素的归属状态了,还得看一下事件状态是否有效,因为事件状态表征的是任务因为非挂起动作导致的不执行而进入挂起链表。
有了上面的规则之后,判断出的结果作为返回结果返回即可。
边栏推荐
- "Matching" is true love, a new attitude for young people to make friends
- 【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
- Flink实时计算topN热榜
- 13. Semaphore critical zone protection
- SQOOP 1.4.6 INSTALL
- 数据库字典Navicat自动生成版本
- 02-taildir source
- Feature (5): how to organize information
- Allure -- common configuration items
- [tutorial] how to make the Helpviewer help document of VisualStudio run independently
猜你喜欢
随机推荐
stm32和电机开发(上位系统)
Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
【Unity3D】嵌套使用Layout Group制作拥有动态子物体高度的Scroll View
Use WinDbg to statically analyze dump files (summary of practical experience)
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
ERROR 1118 (42000): Row size too large (> 8126)
Post disaster reconstruction -- Floyd thought
网络通信学习
[unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
VLAN experiment
Message mechanism -- getting to know messages and message queues for the first time
JS reduce accumulator
12.进程同步与信号量
Test -- Summary of interview questions
对话吴纲:我为什么笃信“大国品牌”的崛起?
"Matching" is true love, a new attitude for young people to make friends
2021-10-04
01安装虚拟机
What is the significance of the college entrance examination
传输优化抽象









