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:

        rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS|QB_RB_FLAG_CREATE);
        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;
                }
        }
        ...
        qb_rb_close(rb);
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;
                }
        }
        ...
        qb_rb_close(rb);
Author:
Angus Salkeld <asalkeld@redhat.com>

See also:
qbrb.h
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 18 Mar 2016 for libqb by  doxygen 1.6.1