当前位置:网站首页>1289_FreeRTOS中vTaskSuspend()接口实现分析
1289_FreeRTOS中vTaskSuspend()接口实现分析
2022-07-04 03:32:00 【grey_csdn】
全部学习汇总: GreyZhang/g_FreeRTOS: learning notes about FreeRTOS. (github.com)
身体状态除了点小问题,分析暂停了一段时间。好在前阵子多写了2个接口的分析,每天的学习惯性没有停下。今天看一下vTaskSuspend()接口的实现,算是我状态恢复的第一次学习。

首先,这个API需要配置生效才会有相关的功能实现。首先,进入临界保护,防止中断的影响。接着获取任务句柄,之后把相应的任务从就绪任务链表中移除。如果移除的时候,相应任务优先级的就绪任务链表空了,那么需要链表重置。

如果任务在等待事件的发生,那么也要处理一下接触相关的链表关系。等这两部分动作结束后,把任务加入到挂起任务链表。

如果任务还在等通知,那么也要处理掉等待的状态。

这个接口是可以从中断中调用的,因此可能有调度器不运行的情况。这时候,需要重置下一次阻塞接触时间点,防止对当前的任务进行操作。

如果要挂起的任务是当前的任务,那么看调度器是否运行。如果调度器在运行,那么需要执行一次任务调度。如果调度器不运行,需要看一下OS中所有的任务都已经挂起了。如果所有的任务全都挂起,当前TCB的指针指向NULL,否则的话请求一次上下文切换。这个上下文切换之前做过分析,本质上其实是选择了就绪的最高优先级的任务,让pxCurrentTCB指向就绪的最高优先级任务的TCB。
这个接口还是很简单的,结合操作系统的几个基础的概念就能够很好理解。
边栏推荐
- Nbear introduction and use diagram
- The difference between MCU serial communication and parallel communication and the understanding of UART
- There is no need to authorize the automatic dream weaving collection plug-in for dream weaving collection
- Webhook triggers Jenkins for sonar detection
- (practice C language every day) pointer sorting problem
- Third party login initial version
- Have you entered the workplace since the first 00???
- [development team follows] API specification
- Monitoring - Prometheus introduction
- Add IDM to Google browser
猜你喜欢
![Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]](/img/0d/7a8370d153a8479b706377c3487220.jpg)
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]

JVM family -- heap analysis

Redis notes (I) Linux installation process of redis

Management and thesis of job management system based on SSM

Unity controls the selection of the previous and next characters

Imperial cms7.5 imitation "D9 download station" software application download website source code

WordPress collection WordPress hang up collection plug-in

7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

1day vulnerability pushback skills practice (3)
随机推荐
[UE4] parse JSON string
Defensive programming skills
Which product is better if you want to go abroad to insure Xinguan?
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
logistic regression
JVM family -- monitoring tools
Future源碼一觀-JUC系列
Enhanced for loop
Rhcsa day 2
潘多拉 IOT 开发板学习(HAL 库)—— 实验6 独立看门狗实验(学习笔记)
2006 translation
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)
MySQL backup notes
[.NET + mqtt]. Mise en œuvre de la communication mqtt dans l'environnement net 6 et démonstration de code pour l'abonnement et la publication de messages bilatéraux du serveur et du client
Contest3145 - the 37th game of 2021 freshman individual training match_ E: Eat watermelon
Package details_ Four access control characters_ Two details of protected
Handler source code analysis
Unspeakable Prometheus monitoring practice
深入浅出对话系统——使用Transformer进行文本分类
CSCI 2134