Best way of storing state?

Hi, I’m using FreeRTOS to write code for a music system and need to be able to save several states simultaneously (boot status, play status, source selected etc). Normally I would do this by having a global struct which contains several enums for each state. Is there a different/more appropriate way to accomplish saving states in FreeRTOS? I’m fairly new to the RTOS world, so excuse me if I’ve missed something obvious here. Many thanks

Best way of storing state?

I am an advocate of “the simplest way that works” – in this case the only reason not to continue to use the structure would be if multiple tasks need to write to the structure at the same time – in which case you would need to use some form of mutual exclusion primitive to ensure one task does not corrupt what another task is doing.

Best way of storing state?

thanks for your response, I’ll probably implement it as before, but with mutual exclusion.