For one of my projects I once ported the kfifo
implementation in the
Linux kernel to a C++ class. Feel free to use it if you'd find it
useful. (GPL)
http://github.com/radarsat1/dimple/blob/master/src/CircBuffer.h
you should add memory barriers, when reading or writing to the reader or
writer indices ... my implementation (without size limitation to a power
of two) can be found at [1]
hth, tim
[1]
http://tim.klingt.org/git?p=boost_lockfree.git;a=blob;f=boost/lockfree/ring…
--
tim(a)klingt.org
http://tim.klingt.org
art is short - life is long
Jack Kerouac