Simple question…can I assume that AudioProcessor::processBlock will not be called again while it is in the middle of execution?
You could have two instances of your plugin getting processed and their processBlock() being called at the same time on different threads. But for 1 instance the should never happen.
Code execution in itself is synchronous. Meaning if someone calls a function it will block until it finished.
Asynchronous is basically returning immediately while making another process/thread start running a synchronous/blocking code.
So any reasonable host won’t run the same instance processBlock on multiple threads.
However, some calls within juce:: AudioProcessor might be called from other threads of course.
I think we have to be clear whether we are talking about ‘in theory’ or ‘in practice’ when answering this question.
The design of the class would expect each instance of the class to have only one call into the processBlock/processBlockBypassed methods at any one moment.
In practice, there are dodgy hosts out there that do all sorts of weird and wonderful things, as the art of writing hosting software is hard. So, in practice, yes, it is totally possible for a host to call into your code from multiple threads, but this is definitely a coding error and not something you should expect and have to deal with.
So, if your implementation is safe, but will produce dodgy output (glitches, wrong data) if it gets called from multiple threads, then i’d say that’s fine. If it does something that could lead to a nasty crash, and potentially bring down a DAW session, then it might be worth coding defensively to ensure you aren’t reentered.