Hi, I couldn’t find another topic that could answer my query hence this post.
Background 1: In my system I have multiple applciaiton tasks and one “TaskManager” task. The task manager task, as the name suggests, manages other application tasks in certain ways and one of them is to enter low power mode. Now, due to architectural reasons, I cannot do low power centric operations/preparations in each of the application tasks and hence this manager task does some of it.
Backgroud 2: The application tasks inter-communicate using the Task notification mechanism and thus “block” on calls like taskNotifyWaitIndexed() for a notification or timeout.
Now in the “TaskManager” task, I need to suspend all applicaiton tasks using vTaskSuspend().
My questions are:
- what happens when
vTaskSuspend()is called from the “TaskManager” task on an applicaiton task which was already blocked on ataskNotifyWaitIndexed()(from its own context, i.e. task function). Does the task move from blocked state to suspended state? As per the task state diagram on the FreeRtos website, I would assume so. - If my assumption in 1 is correct(state = suspended), then, what will happen if a notify signal comes to this suspended task? Again, I would assume it remains suspended as per the task state diagram. And only a call to
vTaskResume()will bring it out of the suspended state. - If my understanding in 2 is correct, then, I have another question. Let’s say my application task was in blocked state due to a call to
xTaskNotifyWaitIndexed()from its own context and then later in time, my “TaskManager” task callsvTaskSuspend()on this task. So now we know, that the tasks is in suspended state. All good! Now after some more time, lets say that theTaskManagertask callsvTaskResume()on this application task and within this timespan, there was no notification sent to it. Then, my understanding is that the task will be brought to ready state which means it will execute on the next chance. Now, this is a bit wrong as in my opinion, the task should still be blocked on thexTaskNotifyWaitIndexed()call. But there is no API to explicitly set task state right?