[LAD] Atomic Operations

Stephen Sinclair radarsat1 at gmail.com
Tue Dec 15 18:51:08 UTC 2009


On Tue, Dec 15, 2009 at 1:33 PM, Gabriel M. Beddingfield
<gabriel at teuton.org> wrote:
>
> Hi Tim,
>
> 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]

Yes, sorry I should have stated the single/single requirement.

I'm not really sure about memory barriers and where and when they're
needed.  In any case I've been using this code successfully for
message passing between threads.  I'm sure there is better code out
there (like in boost), but I just like that it's self-contained.


Steve



More information about the Linux-audio-dev mailing list