rippled
|
Multiple Producer, Multiple Consumer (MPMC) intrusive stack. More...
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. More... | |
bool | push_front (Node *node) |
Push a node onto the stack. More... | |
Element * | pop_front () |
Pop an element off the stack. More... | |
iterator | begin () |
Return a forward iterator to the beginning or end of the stack. More... | |
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 146 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::value_type = Element |
Definition at line 174 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::pointer = Element* |
Definition at line 175 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::reference = Element& |
Definition at line 176 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::const_pointer = Element const* |
Definition at line 177 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::const_reference = Element const& |
Definition at line 178 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::size_type = std::size_t |
Definition at line 179 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::difference_type = std::ptrdiff_t |
Definition at line 180 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, false> |
Definition at line 181 of file LockFreeStack.h.
using beast::LockFreeStack< Element, Tag >::const_iterator = LockFreeStackIterator<LockFreeStack<Element, Tag>, true> |
Definition at line 183 of file LockFreeStack.h.
beast::LockFreeStack< Element, Tag >::LockFreeStack | ( | ) |
Definition at line 185 of file LockFreeStack.h.
|
delete |
|
delete |
bool beast::LockFreeStack< Element, Tag >::empty | ( | ) | const |
Returns true if the stack is empty.
Definition at line 195 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 213 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 239 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 264 of file LockFreeStack.h.
iterator beast::LockFreeStack< Element, Tag >::end | ( | ) |
Definition at line 270 of file LockFreeStack.h.
const_iterator beast::LockFreeStack< Element, Tag >::begin | ( | ) | const |
Definition at line 276 of file LockFreeStack.h.
const_iterator beast::LockFreeStack< Element, Tag >::end | ( | ) | const |
Definition at line 282 of file LockFreeStack.h.
const_iterator beast::LockFreeStack< Element, Tag >::cbegin | ( | ) | const |
Definition at line 288 of file LockFreeStack.h.
const_iterator beast::LockFreeStack< Element, Tag >::cend | ( | ) | const |
Definition at line 294 of file LockFreeStack.h.
|
private |
Definition at line 301 of file LockFreeStack.h.
|
private |
Definition at line 302 of file LockFreeStack.h.