details in xTaskResumeFromISR

In the implementation of xTaskResumeFromISR, it checks the state of scheduler. If the scheduler is not locked, it will change suspended list and ready list directly, otherwise only put the task, which is to be resume, in xPendingReadyList. I don’t understand what’s the main concern for the state of scheduler, since this operation should be called from ISR.

details in xTaskResumeFromISR

There are some point in the kernel which manipulate the scheduler state, which rather than disable interrupts for an extended period of time, will just disable the scheduler. If the interrupt routine attempted to change the state of a task, this could cause a corruption of the scheduler, so the need to move the task to the ready list is noted and handled after the original operation is completed.

details in xTaskResumeFromISR

Thanks richard! I’ve got another question.  Following is  one comment in funciotn xTaskIsTaskSuspended:**
/* Is it in the suspended list because it is in the
Suspended state?  It is possible to be in the suspended
list because it is blocked on a task with no timeout
specified. ***/ This scenario sounds reasonable. My question is what’s the entry function for this scenario? I searched for xSuspendedTaskList in task.c file. I can’t find relevent operations which may results in a blocked task stay in suspended queue. As the global varible xSuspendedTaskList is static, functions outside task.c file would not access it.

details in xTaskResumeFromISR

With a quick check of the source code, the function vTaskPlaceOnEventList check for indefinite timeouts and places these tasks on the suspended task list instead of the delayed task list. (so the task isn’t automatically awakened after a period of time). Thus any call to a blocking function with a timeout delay of portMAX_DELAY that does block, will put the task on the xSuspendedTaskList (and will be removed when the block ends).