[LAD] Atomic Operations

Olivier Guilyardi list at samalyse.com
Tue Dec 15 19:42:33 UTC 2009


On 12/15/2009 08:04 PM, Paul Davis wrote:
> On Tue, Dec 15, 2009 at 1:47 PM, Tim Blechmann <tim at klingt.org> 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.
>> the jack ringbuffer code is not multiprocessor safe then ... it is prbly
>> not an issue for jack1, but maybe for jack2, if it is used there ...
> 
> this was discussed at some considerable length on jack-devel last year, IIRC.
> for single reader/single writer ringbuffers, i believe that we
> concluded that memory barriers are not necessary.

No, to me the conclusion was: we can't programmatically prove that memory
barriers are needed (even on the most vulnerable architectures), but the theory
say that they are, and they should be added for correctness.

--
  Olivier



More information about the Linux-audio-dev mailing list