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

这是接口实现的主要部分,做了一个简单的注释说明。查询实现比较简单,首先判断任务是否在挂起任务的链表当中。如果不在,直接不需要查询了,肯定不是挂起的任务。那么在就一定是挂起的任务吗?其实也不然。
这个接口实现的查询,其实是实现了任务不执行的挂起状态是否是由挂起动作触发的。如果是阻塞导致的挂起,也不应该作为挂起状态返回。由此,判断的就不仅仅是一个链表元素的归属状态了,还得看一下事件状态是否有效,因为事件状态表征的是任务因为非挂起动作导致的不执行而进入挂起链表。
有了上面的规则之后,判断出的结果作为返回结果返回即可。
边栏推荐
- 【MySQL】连接MySQL时出现异常:Connection must be valid and open
- Solution of mysql8 forgetting password file in Windows Environment
- "Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
- [IDL] Research
- 【Unity3D】嵌套使用Layout Group制作拥有动态子物体高度的Scroll View
- 【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
- [Fantasy 4] the transformation from U3D to UE4
- [unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
- Pywin32打开指定窗口
- Blender model import UE, collision settings
猜你喜欢
随机推荐
2021-10-02
Merge ordered sequence
2.hacking-lab脚本关[详细writeup]
4. Random variables
sqoop的表的导入
SQOOP 1.4.6 INSTALL
JS reduce accumulator
flume 190 INSTALL
[unity3d] nested use layout group to make scroll view with dynamic sub object height
使用sqlcipher打开加密的sqlite方法
stm32和电机开发(上位系统)
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
pytest--之测试报告allure配置
【MySQL】连接MySQL时出现异常:Connection must be valid and open
flume 190 INSTALL
Solution of mysql8 forgetting password file in Windows Environment
【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
Vscode auto format
Metaclass type and using metaclass to implement model class ORM
Pytest learning --base




![2.hacking-lab脚本关[详细writeup]](/img/f3/29745761cd5ad4df84c78ac904ea51.png)



