On an embedded system, running freertos, is there any reason why you would not have a blocking function inside a case of a switch statement?
For example, a thread running through a state machine and one of the states is a wait for a task notification.
Typically I've done this with if-else's but is there any advantage or disadvantage to making it a switch case?
Using cpp17 and avoiding STL.
Edit: blocking function, i.e. one that sits forever until it gets a notification, such as xTaskNotifyWait(...)
Example:
switch (state)
{
case state1:
foo();
break;
case state2:
xTaskNotifyWait(...);
};
vs
if (state == state1)
{
foo();
}
else if (state == state2)
{
xTaskNotifyWait(...);
}
TIA