当前位置:网站首页>1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
2022-07-06 13:26:00 【grey_csdn】
全部学习汇总: GreyZhang/g_FreeRTOS: learning notes about FreeRTOS. (github.com)
今天看一个比较简单的接口实现,vTaskResume()的实现。可能是前面分析的接口已经有一些沉淀了,这次看这个接口实现的时候的确是不难,毕竟里面涉及到的接口实现之前都分析过了。


软件中很多接口在我现在的配置中其实是没有奏效的,因此剩余的代码本身就不是很多。
接口最开始,断言的方式判断了任务句柄的有效性。其实,有了这个,下面的判断中的一个条件的状态就已经是确认的了,后面的判断如果在断言开启的状态下多少是有一点冗余的判断了。最基础的判断是先看挂起的任务句柄是否是当前任务的句柄,如果是,这个操作也是没有意义的。因为当前的任务正在运行,不会是挂起的状态,
处理的基本前提条件具备了,接下来就是进行挂起任务的恢复。当然,首先得确认任务是挂起状态。如果是,从挂起任务链表中移除,之后加入到就绪任务链表之中。这样,基本的处理就差不多了。
如果调度器是抢占的,这个时候还得看看被恢复的任务的优先级是否高于现在正在运行的任务优先级。如果是,那么意味着需要进行一次任务切换。
这就是这个接口的实现,比较简单。

再看中断安全版本的API,首先判断了句柄的有效性,其次看了中断优先级的有效性。这里不需要判断与当前执行的Task的关系,因为在ISR中,调度是否运行都尚未可知。

接下来,整体的处理方式跟vTaskResume()差异不大,唯一有差异的地方在于调度器挂起的时候的处理。vTaskResume()执行是在OS的调度代码之中运行的,因此调度器一定是没有挂起的。但是在ISR中,这个则不一定,调度器的状态可能有所不同。因此,多了一个调度器挂起的处理。
边栏推荐
- 启动嵌入式间:资源有限的系统启动
- Nodejs tutorial let's create your first expressjs application with typescript
- The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
- JPEG2000 matlab source code implementation
- WEB功能测试说明
- Technology sharing | packet capturing analysis TCP protocol
- Quick news: the flybook players' conference is held online; Wechat payment launched "education and training service toolbox"
- js中,字符串和数组互转(二)——数组转为字符串的方法
- 在最长的距离二叉树结点
- Data Lake (VIII): Iceberg data storage format
猜你喜欢
Why does MySQL index fail? When do I use indexes?

中国白酒的5场大战

Why do job hopping take more than promotion?

【力扣刷题】32. 最长有效括号

OneNote in-depth evaluation: using resources, plug-ins, templates

MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.

Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing

2017 8th Blue Bridge Cup group a provincial tournament

ICML 2022 | flowformer: task generic linear complexity transformer

Swagger UI tutorial API document artifact
随机推荐
分糖果
Absolute primes (C language)
Quick access to video links at station B
MySQL - transaction details
ACdreamoj1110(多重背包)
Binary tree node at the longest distance
Web开发小妙招:巧用ThreadLocal规避层层传值
Sdl2 source analysis 7: performance (sdl_renderpresent())
语谱图怎么看
R语言做文本挖掘 Part4文本分类
C语言:#if、#def和#ifndef综合应用
Three schemes of SVM to realize multi classification
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
Yyds dry inventory run kubeedge official example_ Counter demo counter
愛可可AI前沿推介(7.6)
Redistemplate common collection instructions opsforzset (VI)
@Detailed differences among getmapping, @postmapping and @requestmapping, with actual combat code (all)
JS get array subscript through array content
guava:Collections.unmodifiableXXX创建的collection并不immutable
【论文解读】用于白内障分级/分类的机器学习技术