Hi,

On Tuesday 15 December 2009 19:33:18 Gabriel M. Beddingfield wrote:
> On Tue, 15 Dec 2009, Tim Blechmann wrote:
> >> http://github.com/radarsat1/dimple/blob/master/src/CircBuffer.h
> > you should add memory barriers, when reading or writing to the reader or
> Actually, his implementation is similar to ringbuffer.c in
> libjack... and assumes that reading and writing can happen
> atomically (as was pointed out by someone else) -- which can
> be managed with single reader / single writer
> requirement.[a]
> Unless I've misunderstood the code, ringbuffer.c is /not/
> using special atomic operations.

Why should a single-reader-single-writer ring-buffer need atomic operations?

The reader increments the read-pointer (which doesn't have to be a pointer) 
last when its finished, the writer increments the write-pointer last when it 
has written. All other access is read-only. No problems. (At least in my app.)

increment = read the old value, add one, modulo (or bit-mask) the size, write 
the new value

Arnold

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Linux-audio-dev mailing list
[email protected]
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Reply via email to