It's the implementation used by libpd for passing messages between the audio thread to the various hooks. It is also used in the libpd Obj-C PdAudioUnit for buffering samples sample rate conversion is happening and the buffer size is inconsistent. If it was broken in some way, we would have heard about it over the last 10+ years or so. I trust the guy who wrote it (Peter Brinkmann) but it is admittedly older code now and I only updated to C atomics in a cursory manner via the macros. If y'all have thoughts/suggestions on improvement, please open an issue (or better a PR) on the libpd Github repo.

On Apr 11, 2024, at 12:00 PM, pd-dev-request@lists.iem.at wrote:

As an aside: is the code in z_ringbuffer.{c,h} considered trustworthy? I
note that the other code in PD appears to use the sys_ringbuffer* API,
which seems to be built on the PA ringbuffer. I ask because I had some
problems with z_ringbuffer.c and after a code read, there are some bits
which look sketchy enough to me that I decided to stop using it.

--------
Dan Wilcox
danomatika.com
robotcowboy.com