Boost logo

Boost :

Subject: Re: [boost] [Boost.Lockfree] Interest in a ringbuffer class
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-01-26 18:05:30

On 26/01/2017 23:56, Raphaël Londeix wrote:
> That's right, but that's not the main selling point. The idea is to be able
> to store raw buffers of different sizes, without any external storage or
> indirection. When you do
> buffer* buf = rb.start_write(10);
> The variable `buf' is stored inside the ring buffer, so that the commit
> operation only change the position of the write cursor. One possible
> way to do that is to define buffer as
> struct buffer {
> size_type size;
> byte_type data[];
> };

That sounds a bit different from what I was imagining. I have a
somewhat similar ringbuffer interface (in terms of separated reserve and
commit) but it assumes single-copy inside the methods; it never exposes
internal buffer memory (because zero-copy gets tricky if you want to
span the ringbuffer's wrap point).

I've only ever used it as a block-of-bytes buffer, typically in cases
where at least one end doesn't care about message boundaries and can
just process bytes in arbitrary chunks.

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