Hello,
We are using circular buffer. The producer
generates the data (a 1024byte char buffer) and the consumer reads it from
circular buffer. In normal case the producer allocates the memory for each item.
we believe this is very inefficient, so that we are going for circular buffer.
How can we make the circualr buffer to allocate the memory in advace and make it
possible for the producer and consumer to share it.
For example if the buffer is of 10 nodes, the
totoal memory allocated by circular buffer would be 10*1024, isn't
it?
How can the producer get the pointer to the next
free node available in the circular buffer? (so as to avoid memory allocation by
the producer)
How can the consumer get pointer to the data
to be read next?
The sample available in boost::circular buffer
describes it with a simple integer based example. I think this kind of problem
is not addressed in it. Some hint will be very useful.
Thanks,
Lloyd
______________________________________
Scanned and protected by Email scanner