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!
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.
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 ?
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.
Ok i konw! Thank you very much!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.