proxygen
|
#include <AtomicIntrusiveLinkedList.h>
Public Member Functions | |
AtomicIntrusiveLinkedList () | |
AtomicIntrusiveLinkedList (const AtomicIntrusiveLinkedList &)=delete | |
AtomicIntrusiveLinkedList & | operator= (const AtomicIntrusiveLinkedList &)=delete |
AtomicIntrusiveLinkedList (AtomicIntrusiveLinkedList &&other) noexcept | |
AtomicIntrusiveLinkedList & | operator= (AtomicIntrusiveLinkedList &&other) noexcept |
~AtomicIntrusiveLinkedList () | |
bool | empty () const |
bool | insertHead (T *t) |
template<typename F > | |
bool | sweepOnce (F &&func) |
template<typename F > | |
void | sweep (F &&func) |
template<typename F > | |
void | reverseSweep (F &&func) |
Private Member Functions | |
template<typename F > | |
void | unlinkAll (T *head, F &&func) |
Static Private Member Functions | |
static T *& | next (T *t) |
static T * | reverse (T *head) |
Private Attributes | |
std::atomic< T * > | head_ {nullptr} |
Definition at line 44 of file AtomicIntrusiveLinkedList.h.
|
inline |
Definition at line 46 of file AtomicIntrusiveLinkedList.h.
|
delete |
|
inlinenoexcept |
Definition at line 50 of file AtomicIntrusiveLinkedList.h.
|
inline |
Note: list must be empty on destruction.
Definition at line 67 of file AtomicIntrusiveLinkedList.h.
|
inline |
Definition at line 71 of file AtomicIntrusiveLinkedList.h.
Referenced by TEST().
|
inline |
Atomically insert t at the head of the list.
Definition at line 80 of file AtomicIntrusiveLinkedList.h.
Referenced by TEST().
|
inlinestaticprivate |
Definition at line 148 of file AtomicIntrusiveLinkedList.h.
|
delete |
|
inlinenoexcept |
Definition at line 55 of file AtomicIntrusiveLinkedList.h.
|
inlinestaticprivate |
Definition at line 154 of file AtomicIntrusiveLinkedList.h.
|
inline |
Similar to sweep() but calls func() on elements in LIFO order.
func() is called for all elements in the list at the moment reverseSweep() is called. Unlike sweep() it does not loop to ensure the list is empty at some point after the last invocation. This way callers can reason about the ordering: elements inserted since the last call to reverseSweep() will be provided in LIFO order.
Example: if elements are inserted in the order 1-2-3, the callback is invoked 3-2-1. If the callback moves elements onto a stack, popping off the stack will produce the original insertion order 1-2-3.
Definition at line 138 of file AtomicIntrusiveLinkedList.h.
Referenced by TEST().
|
inline |
Repeatedly replaces the head with nullptr, and calls func() on the removed elements in the order from tail to head. Stops when the list is empty.
Definition at line 119 of file AtomicIntrusiveLinkedList.h.
Referenced by TEST().
|
inline |
Replaces the head with nullptr, and calls func() on the removed elements in the order from tail to head. Returns false if the list was empty.
Definition at line 104 of file AtomicIntrusiveLinkedList.h.
|
inlineprivate |
Definition at line 168 of file AtomicIntrusiveLinkedList.h.
|
private |
Definition at line 146 of file AtomicIntrusiveLinkedList.h.