当前位置:网站首页>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默认就是处理当前的任务。但是在这个接口中这种解释没有意义,因为任务只要是在执行查询的动作说明当前的任务并没有被挂起。
这是接口实现的主要部分,做了一个简单的注释说明。查询实现比较简单,首先判断任务是否在挂起任务的链表当中。如果不在,直接不需要查询了,肯定不是挂起的任务。那么在就一定是挂起的任务吗?其实也不然。
这个接口实现的查询,其实是实现了任务不执行的挂起状态是否是由挂起动作触发的。如果是阻塞导致的挂起,也不应该作为挂起状态返回。由此,判断的就不仅仅是一个链表元素的归属状态了,还得看一下事件状态是否有效,因为事件状态表征的是任务因为非挂起动作导致的不执行而进入挂起链表。
有了上面的规则之后,判断出的结果作为返回结果返回即可。
边栏推荐
- Aiphacode is not a substitute for programmers, but a tool for developers
- 2.hacking-lab脚本关[详细writeup]
- AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
- [visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
- 快速做出原型
- Solutions to a series of problems in sqoop job creation
- ERROR 1118 (42000): Row size too large (> 8126)
- Sum the two numbers to find the target value
- KS009基于SSH实现宠物管理系统
- Use WinDbg to statically analyze dump files (summary of practical experience)
猜你喜欢
Considerations for Apache deploying static web page projects
[Fantasy 4] introduction and use of UMG components (under update...)
Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
Database dictionary Navicat automatic generation version
Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
The nanny level tutorial of flutter environment configuration makes the doctor green to the end
Message mechanism -- getting to know messages and message queues for the first time
Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud
VLAN experiment
随机推荐
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
Leetcode -- the nearest common ancestor of 236 binary tree
[Lua] summary of common knowledge points (including common interview sites)
Zlib download and use
Mongodb quickly get started with some simple operations of mongodb command line
MPLS experiment
2021-09-12
[IDL] Research
【MySQL】连接MySQL时出现异常:Connection must be valid and open
Deep understanding of redis cache avalanche / cache breakdown / cache penetration
【虚幻4】UMG组件的简介与使用(更新中...)
Shapiro Wilk normal analysis by SPSS
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
Test -- Summary of interview questions
Stm32 et développement de moteurs (système supérieur)
【Unity3D】嵌套使用Layout Group制作拥有动态子物体高度的Scroll View
pytest学习--base
lunix重新分配root 和 home 空间内存
Flink submitter
"Matching" is true love, a new attitude for young people to make friends