proxygen
|
#include <AtomicLinkedList.h>
Classes | |
struct | Wrapper |
Public Member Functions | |
AtomicLinkedList () | |
AtomicLinkedList (const AtomicLinkedList &)=delete | |
AtomicLinkedList & | operator= (const AtomicLinkedList &)=delete |
AtomicLinkedList (AtomicLinkedList &&other) noexcept=default | |
AtomicLinkedList & | operator= (AtomicLinkedList &&other)=default |
~AtomicLinkedList () | |
bool | empty () const |
bool | insertHead (T t) |
template<typename F > | |
void | sweep (F &&func) |
template<typename F > | |
void | reverseSweep (F &&func) |
Private Attributes | |
AtomicIntrusiveLinkedList< Wrapper,&Wrapper::hook > | list_ |
A very simple atomic single-linked list primitive.
Usage:
AtomicLinkedList<MyClass> list; list.insert(a); list.sweep([] (MyClass& c) { doSomething(c); }
Definition at line 35 of file AtomicLinkedList.h.
|
inline |
Definition at line 37 of file AtomicLinkedList.h.
References folly::pushmi::__adl::noexcept(), and folly::AtomicLinkedList< T >::operator=().
|
delete |
|
defaultnoexcept |
|
inline |
Definition at line 43 of file AtomicLinkedList.h.
References folly::AtomicLinkedList< T >::sweep(), and folly::T.
|
inline |
Definition at line 47 of file AtomicLinkedList.h.
References folly::AtomicLinkedList< T >::list_.
|
inline |
Atomically insert t at the head of the list.
Definition at line 56 of file AtomicLinkedList.h.
References folly::AtomicLinkedList< T >::list_, and folly::gen::move.
|
delete |
Referenced by folly::AtomicLinkedList< T >::AtomicLinkedList().
|
default |
|
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 90 of file AtomicLinkedList.h.
References folly::AtomicLinkedList< T >::Wrapper::data, folly::AtomicLinkedList< T >::list_, and folly::gen::move.
|
inline |
Repeatedly pops element from head, and calls func() on the removed elements in the order from tail to head. Stops when the list is empty.
Definition at line 68 of file AtomicLinkedList.h.
References folly::AtomicLinkedList< T >::Wrapper::data, folly::AtomicLinkedList< T >::list_, and folly::gen::move.
Referenced by folly::AtomicLinkedList< T >::~AtomicLinkedList().
|
private |
Definition at line 105 of file AtomicLinkedList.h.
Referenced by folly::AtomicLinkedList< T >::empty(), folly::AtomicLinkedList< T >::insertHead(), folly::AtomicLinkedList< T >::reverseSweep(), and folly::AtomicLinkedList< T >::sweep().