|
rippled
|
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 | push_front (Node *node) |
| Push a node onto the stack. | |
| Element * | pop_front () |
| 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 | m_end |
| std::atomic< Node * > | m_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 127 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::value_type = Element |
Definition at line 155 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::pointer = Element* |
Definition at line 156 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::reference = Element& |
Definition at line 157 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_pointer = Element const* |
Definition at line 158 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_reference = Element const& |
Definition at line 159 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::size_type = std::size_t |
Definition at line 160 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::difference_type = std::ptrdiff_t |
Definition at line 161 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, false> |
Definition at line 162 of file LockFreeStack.h.
| using beast::LockFreeStack< Element, Tag >::const_iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, true> |
Definition at line 163 of file LockFreeStack.h.
| beast::LockFreeStack< Element, Tag >::LockFreeStack | ( | ) |
Definition at line 166 of file LockFreeStack.h.
|
delete |
|
delete |
| bool beast::LockFreeStack< Element, Tag >::empty | ( | ) | const |
Returns true if the stack is empty.
Definition at line 176 of file LockFreeStack.h.
| bool beast::LockFreeStack< Element, Tag >::push_front | ( | 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. |
true if the stack was previously empty. If multiple threads are attempting to push, only one will receive true. Definition at line 194 of file LockFreeStack.h.
| Element * beast::LockFreeStack< Element, Tag >::pop_front | ( | ) |
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.
nullptr if the stack was empty. Definition at line 220 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 245 of file LockFreeStack.h.
| iterator beast::LockFreeStack< Element, Tag >::end | ( | ) |
Definition at line 251 of file LockFreeStack.h.
| const_iterator beast::LockFreeStack< Element, Tag >::begin | ( | ) | const |
Definition at line 257 of file LockFreeStack.h.
| const_iterator beast::LockFreeStack< Element, Tag >::end | ( | ) | const |
Definition at line 263 of file LockFreeStack.h.
| const_iterator beast::LockFreeStack< Element, Tag >::cbegin | ( | ) | const |
Definition at line 269 of file LockFreeStack.h.
| const_iterator beast::LockFreeStack< Element, Tag >::cend | ( | ) | const |
Definition at line 275 of file LockFreeStack.h.
|
private |
Definition at line 282 of file LockFreeStack.h.
|
private |
Definition at line 283 of file LockFreeStack.h.