xenium
Public Member Functions | List of all members
xenium::nikolaev_queue< T, Policies > Class Template Reference

An unbounded lock-free multi-producer/multi-consumer queue. More...

#include <nikolaev_queue.hpp>

Public Member Functions

void push (value_type value)
 Pushes the given value. More...
 
bool try_pop (value_type &result)
 Tries to pop an element from the queue. More...
 

Detailed Description

template<class T, class... Policies>
class xenium::nikolaev_queue< T, Policies >

An unbounded lock-free multi-producer/multi-consumer queue.

This implementation is based on the unbounded MPMC queue proposed by Nikolaev [Nik19].

The nikoleav_queue provides lock-free progress guarantee under the condition that the number of threads concurrently operating on the queue is less than the capacity of a node (see entries_per_node policy).

Supported policies:

Template Parameters
T
Policieslist of policies to customize the behaviour

Member Function Documentation

◆ push()

template<class T , class... Policies>
void xenium::nikolaev_queue< T, Policies >::push ( value_type  value)

Pushes the given value.

Progress guarantees: lock-free

Parameters
value

◆ try_pop()

template<class T , class... Policies>
bool xenium::nikolaev_queue< T, Policies >::try_pop ( value_type &  result)

Tries to pop an element from the queue.

Progress guarantees: lock-free

Parameters
result
Returns
true if the operation was successful, otherwise false