|
xrpld
|
Multiple Producer, Multiple Consumer (MPMC) intrusive stack. More...
#include <LockFreeStack.h>

Classes | |
| class | Node |
Public Types | |
| using | value_type = Element |
| using | pointer = Element* |
| using | reference = Element& |
| using | const_pointer = Element const* |
| using | const_reference = Element const& |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, false> |
| using | const_iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, true> |
Public Member Functions | |
| LockFreeStack () | |
| LockFreeStack (LockFreeStack const &)=delete | |
| LockFreeStack & | operator= (LockFreeStack const &)=delete |
| bool | empty () const |
| Returns true if the stack is empty. | |
| bool | pushFront (Node *node) |
| Push a node onto the stack. | |
| Element * | popFront () |
| Pop an element off the stack. | |
| iterator | begin () |
| Return a forward iterator to the beginning or end of the stack. | |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
Private Attributes | |
| Node | end_ |
| std::atomic< Node * > | head_ |
Multiple Producer, Multiple Consumer (MPMC) intrusive stack.
This stack is implemented using the same intrusive interface as List. All mutations are lock-free.
The caller is responsible for preventing the "ABA" problem: http://en.wikipedia.org/wiki/ABA_problem
| Tag | A type name used to distinguish lists and nodes, for putting objects in multiple lists. If this parameter is omitted, the default tag is used. |
Definition at line 118 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::value_type = Element |
Definition at line 146 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::pointer = Element* |
Definition at line 147 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::reference = Element& |
Definition at line 148 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_pointer = Element const* |
Definition at line 149 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_reference = Element const& |
Definition at line 150 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::size_type = std::size_t |
Definition at line 151 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::difference_type = std::ptrdiff_t |
Definition at line 152 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, false> |
Definition at line 153 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, true> |
Definition at line 154 of file LockFreeStack.h.
| beast::LockFreeStack< Element, Tag >::LockFreeStack | ( | ) |
Definition at line 156 of file LockFreeStack.h.
|
delete |
|
delete |
|
nodiscard |
Returns true if the stack is empty.
Definition at line 166 of file LockFreeStack.h.
| bool beast::LockFreeStack< Element, Tag >::pushFront | ( | Node * | node | ) |
Push a node onto the stack.
The caller is responsible for preventing the ABA problem. This operation is lock-free. Thread safety: Safe to call from any thread.
| node | The node to push. |
Definition at line 184 of file LockFreeStack.h.
| Element * beast::LockFreeStack< Element, Tag >::popFront | ( | ) |
Pop an element off the stack.
The caller is responsible for preventing the ABA problem. This operation is lock-free. Thread safety: Safe to call from any thread.
Definition at line 207 of file LockFreeStack.h.
| iterator beast::LockFreeStack< Element, Tag >::begin | ( | ) |
Return a forward iterator to the beginning or end of the stack.
Undefined behavior results if push_front or pop_front is called while an iteration is in progress. Thread safety: Caller is responsible for synchronization.
Definition at line 229 of file LockFreeStack.h.
| iterator beast::LockFreeStack< Element, Tag >::end | ( | ) |
Definition at line 235 of file LockFreeStack.h.
|
nodiscard |
Definition at line 241 of file LockFreeStack.h.
|
nodiscard |
Definition at line 247 of file LockFreeStack.h.
|
nodiscard |
Definition at line 253 of file LockFreeStack.h.
|
nodiscard |
Definition at line 259 of file LockFreeStack.h.
|
private |
Definition at line 266 of file LockFreeStack.h.
|
private |
Definition at line 267 of file LockFreeStack.h.