Simple Collections
Loading...
Searching...
No Matches
SCThreadingSupport.h File Reference

provides the thread safety implementation for circular buffers More...

Go to the source code of this file.

Typedefs

typedef volatile uint32_t * position_ptr_t
typedef volatile uint32_t position_t

Functions

bool casAtomic (position_ptr_t ptr, position_t expected, position_t newVal)
position_t readAtomic (position_ptr_t ptr)
void atomicInitialisationSupport ()

Detailed Description

provides the thread safety implementation for circular buffers

Contains two definitions that are board specific that allow the circular buffer to be thread safe on a wide range of boards. On mbed and Arduino mbed based boards to uses the mbed utility for CAS. On STM32 M4 and above ARM based boards we use LDREX/STREX to create an atomic write situation. On ESP32 we use the FreeRTOS CAS operation, and on all other boards we disable interrupts around the check. This should work for nearly all cases, even with multiple threads and interrupt usage.