# Quetions about the task scheduler

**URL:** <https://forums.freertos.org/t/quetions-about-the-task-scheduler/13339>\
**Category:** Kernel\
**Created:** [August 27, 2021, 8:18am UTC](https://forums.freertos.org/t/quetions-about-the-task-scheduler/13339 "2021-08-27T08:18:06Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [August 27, 2021, 9:01pm UTC](https://forums.freertos.org/t/quetions-about-the-task-scheduler/13339/5 "2021-08-27T21:01:06Z")

</div>

> [@Yueming](#):
>
> A higher priority IRQ occurs, tick IRQ is switched out. The higher priority IRQ adds a ready task into the ready list and sets uxTopReadyPriority to this task’s priority, let’s assume it is 6.

Reading above, I assume that you are talking about ports which support interrupt nesting. Taking an example of Cortex-M4 - before `vTaskSwitchContext` is called, all the interrupts which can call FreeRTOS APIs (and as a result can alter FreeRTOS lists) are masked: [https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/GCC/ARM\_CM4F/port.c#L463](https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/GCC/ARM_CM4F/port.c#L463). So the scenario you mentioned is not possible. You can look at this response to understand interrupt priorities in Cortex-M: [Understanding priority levels of ISR and FreeRTOS APIs - #16 by aggarg](https://forums.freertos.org/t/understanding-priority-levels-of-isr-and-freertos-apis/10453/16)

Again, as Richard said, if you think there is a bug in a specific port, let us know the port.

Thanks.

---

_[View the full topic](https://forums.freertos.org/t/quetions-about-the-task-scheduler/13339)._
