On Tue, 2008-10-14 at 23:00 +0200, Olivier Guilyardi
wrote:
This isn't the same as Jack's ring
buffer. It's a little wrapper around
Portaudio's ring buffer, which as said above, features memory barriers. Jack's
ring buffer has no memory barrier AFAIK.
it doesn't, but it would be nice if someone would add them. i don't know
why people feel the need to be snarky about the "oh-so-famed JACK
ringbuffer" ... its famed only because when we first implemented it
nobody in the LAD community could find an open source implementation of
the idea. i don't believe anybody has ever claimed that its the bees
knees of lock-free ringbuffers (and if they did, they don't know what
they are talking about). lennart also claims that the JACK
implementation is borked because of "misuse of volatile". it would be
nice if that was fixed too.
I'm no memory barrier expert, but from what I read this looks like a complex
topic. Adding them to jack's ring buffer may be hazardous without carefully
crafted test cases. Bugs related to missing barriers may or may not happen
according to various hardware-related issues.
Here's what Ross Bencina says about it: "the correct implementation of these
algorithms also requires an understanding of the use of memory barriers to force
the order of some memory reads and writes on SMP systems. This is because memory
controllers may reorder reads and writes as observed by other processors on an
SMP system (or by prehipherals on a uniprocessor system)."
As a user of these projects I sense that people from Portaudio, PulseAudio and
Jack could collaborate on this topic. And Ross Bencina's initiative may be the
right place for this: