FreeRTOS-Kernel icon indicating copy to clipboard operation
FreeRTOS-Kernel copied to clipboard

Fix eTaskGetState for pending ready tasks

Open Dazza0 opened this issue 3 years ago • 0 comments

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

  1. From a main task, create a task_A.
  2. task_A blocks/suspends itself
  3. Main task calls vTaskSuspendAll()
  4. Main task triggers an ISR. The ISR unblocks task_A
  5. Main task then calls eTaskGetState on task_A which returns eBlocked/eSuspended even 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.

Dazza0 avatar Oct 17 '22 06:10 Dazza0