Implementing a circular buffer with variable elements

I need to encode a shared buffer (stream 1R / stream 1W) in C for asynchronous binary output in I / O. I usually use the classic circular buffer implementation when it comes to creating a simple shared buffer, but in this case, the size of each element in the buffer is variable and unknown at compile time. I was wondering what a possible implementation of a circular buffer with variable sizes is.

Thanks.

+4
source share
1 answer

You can think of it as a circular binary stream. That is, instead of adding an element, you will write data, instead of popping up, you will read it.

+3
source

All Articles