|
Arduino DLNA Server
|
Lock-free double linked list using atomic operations. More...
#include <ListLockFree.h>
Classes | |
| class | Iterator |
| Bidirectional iterator for ListLockFree. More... | |
| struct | Node |
Public Types | |
| using | NodeAlloc = typename std::allocator_traits< Alloc >::template rebind_alloc< Node > |
Public Member Functions | |
| ListLockFree (const Alloc &alloc=Alloc()) | |
| Default constructor. | |
| ListLockFree (const ListLockFree &ref) | |
| Copy constructor (not thread-safe for the source list) | |
| template<size_t N> | |
| ListLockFree (const T(&a)[N], const Alloc &alloc=Alloc()) | |
| Constructor using array. | |
| ~ListLockFree () | |
| bool | swap (ListLockFree< T > &ref) |
| Swap contents with another list. Not implemented (returns false). | |
| bool | push_back (const T &data) |
| bool | push_front (const T &data) |
| bool | insert (Iterator it, const T &data) |
| bool | pop_front () |
| bool | pop_back () |
| bool | pop_front (T &data) |
| bool | pop_back (T &data) |
| bool | erase (Iterator it) |
| Iterator | begin () |
| Iterator | end () |
| Iterator | rbegin () |
| Iterator | rend () |
| size_t | size () |
| bool | empty () |
| bool | clear () |
| T & | operator[] (int index) |
| Access element at index (O(n)). Not thread-safe under concurrency. Make sure that no other thread modifies the list while using this. | |
| T & | back () |
| Provides the last element. | |
| T & | front () |
| Provides the first element. | |
Protected Member Functions | |
| Node * | createNode () |
| void | deleteNode (Node *p_delete) |
| void | link () |
Protected Attributes | |
| Node | first |
| Node | last |
| std::atomic< size_t > | record_count {0} |
| NodeAlloc | node_alloc_ {} |
Friends | |
| class | Iterator |
| Iterator is a friend for access to internals. | |
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.
| using tiny_dlna::ListLockFree< T, Alloc >::NodeAlloc = typename std::allocator_traits<Alloc>::template rebind_alloc<Node> |
|
inline |
Default constructor.
|
inline |
Copy constructor (not thread-safe for the source list)
|
inline |
Constructor using array.
|
inline |
|
inline |
Provides the last element.
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
Provides the first element.
|
inline |
|
inlineprotected |
|
inline |
Access element at index (O(n)). Not thread-safe under concurrency. Make sure that no other thread modifies the list while using this.
| index | Index of element |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Swap contents with another list. Not implemented (returns false).
|
friend |
Iterator is a friend for access to internals.
|
protected |
|
protected |
|
protected |
|
protected |