FreeRTOS kernel code problem

why use variable xPendingReadyList in the source code ? it can insert ready task into readylist directly without causing any safe problems. very appreciate for your answering in time!

FreeRTOS kernel code problem

xPendingReadyList is used to temporarily hold tasks that have been moved into the Ready state by an interrupt while the scheduler was locked. Its use allows interrupts to remain enabled when the scheduler is locked. Scheduler locking is a lighter form of critical section that prevents the kernel from performing context switches. The alternative is to use a full critical section, but that would mean at least a subset of interrupt priorities would be masked. Regards.

FreeRTOS kernel code problem

Ok thank you! But why we can not insert the tasks that have been moved into the Ready into the pxReadyTasksLists directly while the scheduler was locked? In the security considerations ? Regards

FreeRTOS kernel code problem

Locking the scheduler is one way to implement a critical section when internal state is being manipulated. If the task that locked the schedule is doing something to the ready list, the LAST thing you want to do is manipulate it yourself, the like result is a corrupted list.

FreeRTOS kernel code problem

Ok i konw! Thank you very much!