当前位置:网站首页>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。
这个接口还是很简单的,结合操作系统的几个基础的概念就能够很好理解。
边栏推荐
- Code Execution Vulnerability - no alphanumeric rce create_ function()
- Backpropagation formula derivation [Li Hongyi deep learning version]
- logistic regression
- Examination question bank of constructor decoration direction post skills (constructor) and examination data of constructor decoration direction post skills (constructor) in 2022
- Audio and video technology development weekly | 232
- Management and thesis of job management system based on SSM
- How to pipe several commands in Go?
- [development team follows] API specification
- Monitoring - Prometheus introduction
- 查詢效率提昇10倍!3種優化方案,幫你解决MySQL深分頁問題
猜你喜欢
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
Monitoring - Prometheus introduction
Unity controls the selection of the previous and next characters
Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami
Setting methods, usage methods and common usage scenarios of environment variables in postman
Record a problem that soft deletion fails due to warehouse level error
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
The difference between MCU serial communication and parallel communication and the understanding of UART
Nbear introduction and use diagram
Fudan released its first review paper on the construction and application of multimodal knowledge atlas, comprehensively describing the existing mmkg technology system and progress
随机推荐
Want to do something in production? Then try these redis commands
Leetcode51.n queen
Contest3145 - the 37th game of 2021 freshman individual training match_ J: Eat radish
MySQL query
Is online futures account opening safe and reliable? Which domestic futures company is better?
Jenkins configures IP address access
Baijia forum the founding of the Eastern Han Dynasty
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
Typical applications of minimum spanning tree
Code Execution Vulnerability - no alphanumeric rce create_ function()
[PaddleSeg 源码阅读] PaddleSeg计算 mIoU
The difference between MCU serial communication and parallel communication and the understanding of UART
潘多拉 IOT 开发板学习(HAL 库)—— 实验6 独立看门狗实验(学习笔记)
what does ctrl + d do?
Management and thesis of job management system based on SSM
Add IDM to Google browser
Basé sur... Netcore Development blog Project Starblog - (14) Implementation of theme switching function
Imperial cms7.5 imitation "D9 download station" software application download website source code
Day05 錶格
functools下的reduce函数