Re: [LAD] a *simple* ring buffer, comments pls?

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Fri Jul 08 2011 - 21:39:25 EEST

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
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sat Jul 9 00:15:02 2011

This archive was generated by hypermail 2.1.8 : Sat Jul 09 2011 - 00:15:02 EEST