template <class T>
AtomicIntrusiveStack class
Lock-free stack with atomic push()
and pop_all
operations. Relies on unqualified calls to atomic<T*>& atomic_next_ptrref(T*)
.
Public functions
- auto empty() const → bool
- Check if poppingreturns null.
- auto pop_all() → T*
- auto pop_reversed() → T*
- auto push(T* el) → bool
- Atomically push
el
onto the stack, returnswas_empty
. - auto push_chain(T* first, T* last) → bool
- Atomically push linked nodes
first->…->last
onto the stack, returnswas_empty
.
Function documentation
template <class T>
T* Ase::AtomicIntrusiveStack::pop_all()
Atomically pop all elements from the stack in LIFO order. Use atomic_next_ptrref()
for iteration.
template <class T>
T* Ase::AtomicIntrusiveStack::pop_reversed()
Atomically pop all elements from the stack in FIFO order. Use atomic_next_ptrref()
for iteration.