#include <SCCircularBuffer.h>
Public Types | |
| enum | BufferType { CIRCULAR_BUFFER , MEMORY_POOL } |
Public Attributes | |
| volatile uint32_t | casExchangeSpins = 0 |
Create a circular buffer that has a fixed size and can be filled and read at the same time one character at a time. It is very thread safe on ESP32 and mbed based boards, it is thread safe on other boards, unless you are using that board with an unexpected RTOS, in which case you would need to determine suitability yourself.
Imagine the buffer like a circle with a given number of segments, both the reader and writer pointers start at 0. As the data structure fills up the writer will move around, and the reader can try and "keep up". Once the reader or writer gets to the end it will go back to 0 (start). This is by design and therefore, IT'S POSSIBLE TO LOSE DATA.