Threading in audio plug-ins

I'm new to Juce. I was been able to get up-and-running and built a few textbook examples of filters just to learn the Juce landscape. I wanted to improve the design of my plug-in as it always computes the filter coefficients at the top of the processBlock function rather than re-computing them only when a UI parameter changes. I've been reading through the forums on this and it seems there are lock-free solutions for this (e.g., bazrush, TheVinn, Juce's lock-free FIFO, etc). A few solutions call out that they are one reader / one writer solutions -- is safe to always assume this in audio plug-ins?

As an example, the UI will have call-backs run on some thread and the audio processing will happen in a separate thread, so I should be able to write into the FIFO in the UI thread and read from the FIFO in the audio thread. The thing that is bothering me is that I thought I read somewhere in the forum (can't find it now for the life of me...) that it is possible for parameter updates to happen in the audio thread immediately before processBlock. So, that would mean that both the UI thread and the audio thread are writing to the FIFO.  1) can that happen and 2) wouldn't that wreak havok on one-reader-one-writer FIFOs?

thanks!

> that it is possible for parameter updates to happen in the audio thread immediately before processBlock

Yes that can happen, as a plugin developer you need to be prepared for anything that can possibly happen :-/

I use a multiple-writer-one reader fifo (simply use a lock for write operations)

But you have to still consider that you might need to read the fifo outside the audio-thread too (when plugin is bypassed, or the queue is full, and you need to update the plugin-parameters for GUI feedback etc...)

ah, good to know i'm not crazy with my concerns. If you lock on write and the audio thread can write, that seems to go against the advice to not lock in the audio thread (e.g., that nice Ross Bencina article, and I believe Jules has mentioned numerous times in the forums) -- but I'm not sure of a better solution. Do most people just shrug off this advice for plug-ins? thanks again for the response.