Anklang C++ API 0.0.0
Loading...
Searching...
No Matches
AtomicIntrusiveStack< T >

#include "atomics.hh"

Public Member Functions

AtomicIntrusiveStack ()
boolempty () const
T *pop_all ()
T *pop_reversed ()
boolpush (T *el)
boolpush_chain (T *first, T *last)

Detailed Description

template<class T>
class Ase::AtomicIntrusiveStack< T >

Lock-free stack with atomic `push()` and `pop_all` operations. Relies on unqualified calls to `atomic<T*>& atomic_next_ptrref(T*)`.

Constructor & Destructor Documentation

AtomicIntrusiveStack()

template<class T >
AtomicIntrusiveStack ( )

Member Function Documentation

empty()

template<class T >
bool empty ( ) const

Check if poppingreturns null.

push_chain()

template<class T >
bool push_chain ( T * first,
T * last
)

Atomically push linked nodes `first->…->last` onto the stack, returns `was_empty`.

push()

template<class T >
bool push ( T * el)

Atomically push `el` onto the stack, returns `was_empty`.

pop_all()

template<class T >
T * pop_all ( )

Atomically pop all elements from the stack in LIFO order. Use `atomic_next_ptrref()` for iteration.

pop_reversed()

template<class T >
T * pop_reversed ( )

Atomically pop all elements from the stack in FIFO order. Use `atomic_next_ptrref()` for iteration.