treywelsh / ring_buffer

A ring buffer implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ring buffer

It's a basic implementation of a ring buffer. The goal was to provide different level of control on the ring with unsafe/safe operations regarding if the thread is empty/full.

If RINGB_SPSC_SAFE is defined at compile time it's thread safe regarding atomics from the C11 standard.

In order to reuse this data structure in an other project, you will have to redefine the type of the stored data "rbuff_data_t".

NOTE: ringb_init( ... , 3) will initialize a ring buffer with a capacity of 2^3 - 1 = 7 elements. It's due to a choice of implementation to detect empty/full ring buffer.

About

A ring buffer implementation

License:BSD 2-Clause "Simplified" License


Languages

Language:C 89.3%Language:Makefile 10.7%