当前位置:网站首页>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。
这个接口还是很简单的,结合操作系统的几个基础的概念就能够很好理解。
边栏推荐
- Have you entered the workplace since the first 00???
- No clue about the data analysis report? After reading this introduction of smartbi, you will understand!
- 2006 translation
- 选择排序与冒泡排序模板
- Future源碼一觀-JUC系列
- Solve the problems encountered by the laravel framework using mongodb
- Why is it recommended that technologists write blogs?
- JSON string conversion in unity
- 1day vulnerability pushback skills practice (3)
- @Scheduled scheduled tasks
猜你喜欢

How to use websocket to realize simple chat function in C #

Practical multifunctional toolbox wechat applet source code / support traffic master

Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami

Fudan released its first review paper on the construction and application of multimodal knowledge atlas, comprehensively describing the existing mmkg technology system and progress
![Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]](/img/ad/b675364fcaf5d874397fd0cbfec11b.jpg)
Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]
![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]

Redis transaction

Audio and video technology development weekly | 232

The 37 year old programmer was laid off, and he didn't find a job for 120 days. He had no choice but to go to a small company. As a result, he was confused

Development of digital collection trading platform development of digital collection platform
随机推荐
Unspeakable Prometheus monitoring practice
Day05 錶格
Unity controls the selection of the previous and next characters
How to use websocket to realize simple chat function in C #
Session learning diary 1
Osnabrueck University | overview of specific architectures in the field of reinforcement learning
7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
Leecode 122. Zuijia timing of buying and selling stocks ②
[.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
Practical multifunctional toolbox wechat applet source code / support traffic master
Amélioration de l'efficacité de la requête 10 fois! 3 solutions d'optimisation pour résoudre le problème de pagination profonde MySQL
Site favorites
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
2006 translation
Imperial cms7.5 imitation "D9 download station" software application download website source code
Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
Backpropagation formula derivation [Li Hongyi deep learning version]
(practice C language every day) pointer sorting problem
JSON string conversion in unity