[LAD] a *simple* ring buffer, comments pls?
Fons Adriaensen
fons at linuxaudio.org
Fri Jul 8 18:39:25 UTC 2011
On Fri, Jul 08, 2011 at 01:12:08PM -0500, Gabriel M. Beddingfield wrote:
> There's a remote possibility that the compiler could
> optimize this as:
>
> rb->read_ptr += n;
> rb->read_ptr &= rb->size_mask;
>
> ...and this would break the ringbuffer. I don't know if the
> `volatile` keyword prevents this or not.
It certainly does.
Ciao,
--
FA
More information about the Linux-audio-dev
mailing list