The Portaudio
code looks more and more robust to me. It's also
surprisingly short. Maybe that the best would be to replace jack's
ringbuffer with it? I think it should be possible to keep the
jack_ringbuffer api unchanged.
I'd rather add the memory barriers to the JACK code, but this could be a
race to see who does what first. A memory barrier is typically single
instruction. The complication tends to be defining them in a
sufficiently portable way.
gcc provides built-in memory barriers, which are straight-forward to
use ... beside that, one could use an abstraction layer, providing
assembler code (iirc, portaudio implements memory barriers for multiple
platforms as macros) ...
there is also the atomic_ops project [1], providing atomic operations for
multiple platforms ... it had some issues, when i first tried it two
years ago, but they seem to be resolved now ...
best, tim
[1]
http://www.hpl.hp.com/research/linux/atomic_ops/
--
tim(a)klingt.org
http://tim.klingt.org
art is short - life is long
Jack Kerouac