Synchronizing set/getStateInformation and processBlock?

Hey everyone. I’m new to JUCE development, so apologies in advance if my questions don’t make sense

Questions:
Do I need to synchronize access to member variables that are used by both processBlock and set/getStateInformation? If my understanding is correct, set/getStateInformation are called from the message thread while processBlock runs on the audio thread. If the member variables of my processor aren’t atomic, wouldn’t this cause a data race?
The only way I can see this being valid is if the host somehow ensures that processBlock and set/getStateInformation are never called at the same time? Is this the case? Or is it invalid and do I have to use atomics or some other kind of synchronization for all of my processor’s member variables?

yes, in JUCE processBlock and set/getStateInformation can be called at the same time on different threads. So yes you need some synchronization.

Thanks for the rely
atomics it is :stuck_out_tongue:

Also to anyone reading this, if you have more questions about synchronization in JUCE, this thread might be of interest to you