arduino-audio-tools
|
Lock-free double linked list using atomic operations. More...
#include <ListLockFree.h>
Classes | |
class | Iterator |
struct | Node |
Public Member Functions | |
ListLockFree (Allocator &allocator=DefaultAllocator) | |
Default constructor. | |
ListLockFree (const ListLockFree &ref) | |
Copy constructor (not thread-safe for the source list) | |
template<size_t N> | |
ListLockFree (const T(&a)[N], Allocator &allocator=DefaultAllocator) | |
Constructor using array. | |
T & | back () |
Provides the last element. | |
Iterator | begin () |
bool | clear () |
bool | empty () |
Iterator | end () |
bool | erase (Iterator it) |
T & | front () |
Provides the first element. | |
bool | insert (Iterator it, const T &data) |
T & | operator[] (int index) |
bool | pop_back () |
bool | pop_back (T &data) |
bool | pop_front () |
bool | pop_front (T &data) |
bool | push_back (const T &data) |
bool | push_front (const T &data) |
Iterator | rbegin () |
Iterator | rend () |
void | setAllocator (Allocator &allocator) |
size_t | size () |
bool | swap (ListLockFree< T > &ref) |
Protected Member Functions | |
Node * | createNode () |
void | deleteNode (Node *p_delete) |
void | link () |
Protected Attributes | |
Node | first |
Node | last |
Allocator * | p_allocator = &DefaultAllocator |
std::atomic< size_t > | record_count {0} |
Friends | |
class | Iterator |
Lock-free double linked list using atomic operations.
T |
This implementation provides thread-safe operations without using locks. It uses atomic pointers and compare-and-swap operations for synchronization. Note: Some operations like size() may not be perfectly consistent in highly concurrent scenarios but will be eventually consistent.