FreeRTOS-Kernel
FreeRTOS-Kernel copied to clipboard
Fix eTaskGetState for pending ready tasks
Fix eTaskGetState for pending ready tasks
Description
The description of the eReady enum is inclusive of tasks that are pending ready
eReady, /* The task being queried is in a ready or pending ready list. */
However, the current implementation of the eTaskGetState function only checks a task's state list item, thus will return a non-eReady state for tasks that are pending ready.
Test Steps
- From a main task, create a task_A.
- task_A blocks/suspends itself
- Main task calls
vTaskSuspendAll() - Main task triggers an ISR. The ISR unblocks task_A
- Main task then calls
eTaskGetStateon task_A which returnseBlocked/eSuspendedeven though task_A has been unblocked by the ISR.
Notes:
- We discovered this issue through one of our kernel unit tests. I can post the test source code here if that helps
- The SMP branch should also have the same issue. But I can raise a PR for the SMP branch once the fix for the mainline branch has been finalized.
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.