libqb  1.0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Ringbuffer

This implements a ring buffer that works in "chunks" not bytes.

So you write/read a complete chunk or not at all. There are two types of ring buffer normal and overwrite. Overwrite will reclaim the oldest chunks inorder to make way for new ones, the normal version will refuse to write a new chunk if the ring buffer is full.

This implementation is capable of working across processes, but one process must only write and the other prrocess read.

The read process will do the following:

* for (i = 0; i < 200; i++) {
* try_read_again:
* l = qb_rb_chunk_read(rb, (void *)out, 32, 1000);
* if (l < 0) {
* goto try_read_again;
* }
* }
* ...
*
*

The write process will do the following:

* rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS);
* for (i = 0; i < 200; i++) {
* try_write_again:
* l = qb_rb_chunk_write(rb, &v, sizeof(v));
* if (l < sizeof(v)) {
* goto try_write_again;
* }
* }
* ...
*
Author
Angus Salkeld asalk.nosp@m.eld@.nosp@m.redha.nosp@m.t.co.nosp@m.m
See Also
qbrb.h