[LAD] Atomic Operations

Tim Blechmann tim at klingt.org
Tue Dec 15 18:47:50 UTC 2009


>>> 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 ...


>> writer indices ... my implementation (without size limitation to a power
>> of two) can be found at [1]
>>
>> [1]
>> http://tim.klingt.org/git?p=boost_lockfree.git;a=blob;f=boost/lockfree/ringbuffer.hpp;h=139f79869f610c61b0d117d2836a3c8c4949db02;hb=03d4e397a74f2b85c87f6b54b4755428956ff63a
> 
> This looks nice, too.  Have you considered trying to give it 
> an interface like the existing boost::circular_buffer<T,Alloc>?
> The distinguishing feature of your implementation is that is 
> lock-free... but it's otherwise the same concept (and 
> already in Boost).

i actually tried to match the interface to boost::lockfree::fifo, which
provides a multi-producer/multi-consumer queue.


> Also, does yours have a single reader / single writer 
> requirement?

yes

> I tried to clone the git repos, but hit ^C when it was 
> 20% and 40MB (!!).  :-)

it includes the full source tree of boost (160mb on my machine)

cheers, tim

-- 
tim at klingt.org
http://tim.klingt.org

Happiness is a byproduct of function, purpose, and conflict; those who
seek happiness for itself seek victory without war.
  William S. Burroughs

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20091215/52a2f6e2/attachment.pgp>


More information about the Linux-audio-dev mailing list