当前位置:网站首页>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。
这个接口还是很简单的,结合操作系统的几个基础的概念就能够很好理解。
边栏推荐
- Résumé des outils communs et des points techniques de l'examen PMP
- 150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
- [development team follows] API specification
- Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]
- 7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
- How to pipe several commands in Go?
- I stepped on a foundation pit today
- Li Chuang EDA learning notes 13: electrical network for drawing schematic diagram
- Typical applications of minimum spanning tree
- 【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
猜你喜欢

Problems and solutions of several concurrent scenarios of redis

Defensive programming skills

JSON string conversion in unity

Want to do something in production? Then try these redis commands

The first spring of the new year | a full set of property management application templates are presented, and Bi construction is "out of the box"

Add IDM to Google browser

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

基于PHP的轻量企业销售管理系统
![[latex] production of complex tables: excel2latex and detail adjustment](/img/39/0d448ddf006eda262de3ed75666354.jpg)
[latex] production of complex tables: excel2latex and detail adjustment

Unspeakable Prometheus monitoring practice
随机推荐
Setting methods, usage methods and common usage scenarios of environment variables in postman
Sword finger offer:55 - I. depth of binary tree
2022 attached lifting scaffold worker (special type of construction work) free test questions and attached lifting scaffold worker (special type of construction work) examination papers 2022 attached
Recursive structure
super_ Subclass object memory structure_ Inheritance tree traceability
In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
[.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_ 1: Origami
[untitled]
WP collection plug-in free WordPress collection hang up plug-in
[PaddleSeg 源码阅读] PaddleSeg Transform 的 Normalize操作
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]
The property of judging odd or even numbers about XOR.
WordPress collection WordPress hang up collection plug-in
JS object definition
Record a problem that soft deletion fails due to warehouse level error
Contest3145 - the 37th game of 2021 freshman individual training match_ G: Score
Site favorites
[latex] production of complex tables: excel2latex and detail adjustment
I stepped on a foundation pit today