Given a task handle, I need to find the state of a task; either Ready, Blocked, or Suspended. How do I do that? I don’t see a function for that.
> Given a task handle, I need to find the state of a task; either Ready, Blocked, or Suspended.
> I don’t see a function for that.
FreeRTOS doesn’t provide such a function.
> How do I do that?
Keep tracking of what you’re programming. If the task is executed it is in ready/run state. If you call vTaskDelay() it switches to blocked state for number of ticks. If you call vTaskSuspend() the task is in state suspended.
You could implement such a function but it would not be particularly quick. The list from which a task is referenced denotes the tasks state, and as references are bidirectional it is straightforward to find the list. Look at the function vTaskList() for some clues - this prints out information on each task, including the state of the task.
All of the lists are static. I can’t access them from outside of the tasks.c module. Is there a global way to access the lists?