Honeycomb
0.1
Component-Model Framework
|
Lock-free doubly-linked list. More...
#include <List.h>
Classes | |
class | Iter_ |
Iterator. More... | |
class | IterR_ |
Reverse iterator. More... | |
Public Types | |
typedef T | value_type |
typedef Alloc_ | Alloc |
typedef Iter_< T > | Iter |
typedef Iter_< const T > | ConstIter |
typedef IterR_< T > | IterR |
typedef IterR_< const T > | ConstIterR |
Public Member Functions | |
List (const Alloc &alloc=Alloc(), int threadMax=10) | |
~List () | |
template<class T_ > | |
void | push_front (T_ &&val) |
Insert new element constructed with val at the beginning of the list. More... | |
template<class T_ > | |
void | push_back (T_ &&val) |
Add new element constructed with val onto the end of the list. More... | |
bool | pop_front (optional< T & > val=optnull) |
Remove element from the beginning of the list and move it into val . Returns true on success, false if there is no element to pop. More... | |
bool | pop_back (optional< T & > val=optnull) |
Remove element from the end of the list and move it into val . Returns true on success, false if there is no element to pop. More... | |
ConstIter | begin () const |
Get iterator to the beginning of the list. More... | |
Iter | begin () |
ConstIter | end () const |
Get iterator to the end of the list. More... | |
Iter | end () |
ConstIterR | rbegin () const |
Get reverse iterator to the end of the list. More... | |
IterR | rbegin () |
ConstIterR | rend () const |
Get reverse iterator to the beginning of the list. More... | |
IterR | rend () |
bool | front (T &val) |
Get a copy of the element at the beginning of the list. Returns true on success, false if there is no element. More... | |
bool | back (T &val) |
Get a copy of the element the end of the list. Returns true on success, false if there is no element. More... | |
template<class T_ > | |
Iter | insert (const Iter &it, T_ &&val) |
Insert new element constructed with val before iterator position. Returns iterator pointing to new element. More... | |
bool | erase (Iter &it, optional< T & > val=optnull) |
Erase element at iterator position and move it into val , and advance iterator. Returns true if this thread erased the element, false if already erased. More... | |
void | clear () |
Remove all elements. More... | |
bool | empty () const |
Check whether the list does not contain any elements. More... | |
szt | size () const |
Number of elements in list. More... | |
Friends | |
template<class > | |
class | HazardMem |
Lock-free doubly-linked list.
Based on the paper: "Lock-free deques and doubly linked lists", Sundell, et al. - 2008
T | Container element type |
Alloc_ | Allocator for elements, should be lock-free. If using MemPool then ensure it has a bucket large enough to hold List<T>::Node. |
Backoff | Backoff algorithm to reduce contention |
iterMax | Max number of iterator instances per thread |
typedef Alloc_ honey::lockfree::List< T, Alloc_, Backoff, iterMax >::Alloc |
typedef Iter_<const T> honey::lockfree::List< T, Alloc_, Backoff, iterMax >::ConstIter |
typedef IterR_<const T> honey::lockfree::List< T, Alloc_, Backoff, iterMax >::ConstIterR |
typedef Iter_<T> honey::lockfree::List< T, Alloc_, Backoff, iterMax >::Iter |
typedef IterR_<T> honey::lockfree::List< T, Alloc_, Backoff, iterMax >::IterR |
typedef T honey::lockfree::List< T, Alloc_, Backoff, iterMax >::value_type |
|
inline |
alloc | |
threadMax | Max number of threads that can access this container. Use a thread pool so the threads have a longer life cycle than this container. |
|
inline |
|
inline |
Get a copy of the element the end of the list. Returns true on success, false if there is no element.
|
inline |
Get iterator to the beginning of the list.
|
inline |
|
inline |
Remove all elements.
|
inline |
Check whether the list does not contain any elements.
|
inline |
Get iterator to the end of the list.
|
inline |
|
inline |
Erase element at iterator position and move it into val
, and advance iterator. Returns true if this thread erased the element, false if already erased.
|
inline |
Get a copy of the element at the beginning of the list. Returns true on success, false if there is no element.
|
inline |
Insert new element constructed with val
before iterator position. Returns iterator pointing to new element.
|
inline |
Remove element from the end of the list and move it into val
. Returns true on success, false if there is no element to pop.
|
inline |
Remove element from the beginning of the list and move it into val
. Returns true on success, false if there is no element to pop.
|
inline |
Add new element constructed with val
onto the end of the list.
|
inline |
Insert new element constructed with val
at the beginning of the list.
|
inline |
Get reverse iterator to the end of the list.
|
inline |
|
inline |
Get reverse iterator to the beginning of the list.
|
inline |
|
inline |
Number of elements in list.
|
friend |