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

A fast unbounded lock-free multi-producer/multi-consumer FIFO queue. More...

#include <ramalhete_queue.hpp>

Public Member Functions

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

Detailed Description

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

A fast unbounded lock-free multi-producer/multi-consumer FIFO queue.

This is an implementation of the FAAArrayQueue by Ramalhete and Correia [Ram16].

It is faster and more efficient than the michael_scott_queue, but less generic as it can only handle pointers or trivially copyable types that are smaller than a pointer (i.e., T must be a raw pointer, a std::unique_ptr or a trivially copyable type like std::uint32_t). Note: std::unique_ptr are supported for convinience, but custom deleters are not yet supported.

A generic version that does not have this limitation is planned for a future version.

Supported policies:

Template Parameters
T
Policieslist of policies to customize the behaviour

Member Function Documentation

◆ push()

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

Pushes the given value to the queue.

This operation might have to allocate a new node. Progress guarantees: lock-free (may perform a memory allocation)

Parameters
value

◆ try_pop()

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

Tries to pop an object from the queue.

Progress guarantees: lock-free

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