Anklang C++ API 0.0.0
Loading...
Searching...
No Matches
MpmcStack< Node >

#include "atomics.hh"

Public Member Functions

boolempty () const
MpmcStack ()
Node *peek ()
Node *pop ()
boolpush (Node *node)
~MpmcStack ()

Detailed Description

template<typename Node>
struct Ase::MpmcStack< Node >

Multi-producer, multi-consumer stack for non-reclaimable memory nodes. Multiple producers can push and multiple consumers can pop nodes concurrently, but no thread may still be in calls to push/pop during destruction and the stack has to be empty for destruction. Nodes need to provide a nullptr-initialized intrusive `.intr_ptr_` pointer member to be pushed and must stay readable during the stack lifetime. The push() and pop() methods are lock free but not wait free and synchronize through the same memory cell, so for lots of clients they can easily become the single bottleneck.

Constructor & Destructor Documentation

MpmcStack()

template<typename Node >
MpmcStack ( )

~MpmcStack()

template<typename Node >
~MpmcStack ( )

Member Function Documentation

empty()

template<typename Node >
bool empty ( ) const

push()

template<typename Node >
bool push ( Node * node)

pop()

template<typename Node >
Node * pop ( )

peek()

template<typename Node >
Node * peek ( )