Boost logo

Boost :

Subject: Re: [boost] [Boost.Lockfree] Interest in a ringbuffer class
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-01-26 05:51:12

>> Is there any interest in having a lower level ringbuffer type in
>> Boost.Lockfree ?
> the ringbuffer will be basically using the same algorithm as the
> spsc_queue under the hood, but basically separate 'algorithm' from
> 'storage', right?
> afaict the spsc_queue can already be used in shared memory, though
> zero-copy is limited to pushing movable types and consuming via a
> functor (haven't checked the code for a while, though). mmap for buffer
> wrapping would be really cool to have, though ...

I did an unusual variation on a lock free ringbuffer at
It's policy driven, STL compliant API, types stored must be trivial.

The unusual variation part is that unlike a queue, this is a fixed size
history. You cannot remove items, only push items. Once full every new
item you push removes the last item in the history. Because the atomic
counter always rises, iterators to expired items correctly expire. This
makes them safe to hand out to others, though of course dereferencing an
iterator is racy.

I'd agree with Tim that the spsc_queue is too similar to the proposed
ringbuffer to make much sense. Any additions need to be more
significantly different like say the ringbuffer log mentioned.


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at