Hi folks:
I want to know if xYieldPending is pdTRUE when the scheduler is suspended,does xTaskIncrementTick will return pdTRUE.Then it will make the next context switch occurs.But at this moment, the scueduler is suspended.
When the scheduler is suspended xTaskIncrementTick
just increments xPendedTicks
and returns pdFALSE
- FreeRTOS-Kernel/tasks.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub.
Well,thank you for your answer.But my source code version is FreeRtos - V9.0.0,and the function xTaskIncrementTick in tasks.c will return pdTRUE when the scheduler is suspended,so i don’t understand a little bit.
This was change in version in 10.3.0 in this commit - Update to the latest atomic.h. · FreeRTOS/FreeRTOS-Kernel@16639d2 · GitHub.
The following is from the commit message -
Efficiency improvement: Make sure xTaskIncrementTick() does not return pdTRUE when the scheduler is locked. This just prevents an unnecessary yield interrupt (unnecessary as it is ignored) when xYieldPending happens to be pdTRUE.
Is this causing a problem for you?
No.I am new to learn FreeRtos,I’m just learning the source code when there are some things i don’t understand.
In version V9.0.0,xTaskIncrementTick() return pdTRUE when the scheduler is locked.As it will make yield interrupt only,but no task switching occurred.
Am I understanding this right?
Yes, that is correct.
Ok,now i am understand.Thank you very much.
---- Replied Message ----
From | Gaurav Aggarwal via FreeRTOS Community Forumsfreertos@discoursemail.com |
- | - |
Date | 06/24/2024 16:36 |
To | sty1057380093@163.com |
Cc | |
Subject | [FreeRTOS Community Forums] [Kernel] About xYieldPending when the scheduler is suspended! |
| aggarg Gaurav Aggarwal AWS
June 24 |
- | - |
suntianyun:
In version V9.0.0,xTaskIncrementTick() return pdTRUE when the scheduler is locked.As it will make yield interrupt only,but no task switching occurred.
Am I understanding this right?
Yes, that is correct.