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

A bounded lock-free multi-producer/multi-consumer k-FIFO queue. More...

#include <kirsch_bounded_kfifo_queue.hpp>

Public Member Functions

bool try_push (value_type value)
 Tries to push a new element to the queue. More...
 
bool try_pop (value_type &result)
 Tries to pop an element from the queue. More...
 

Static Public Attributes

static constexpr std::size_t entry_size = sizeof(entry)
 Provides the effective size of a single queue entry (including padding).
 

Detailed Description

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

A bounded lock-free multi-producer/multi-consumer k-FIFO queue.

This is an implementation of the proposal by Kirsch et al. [KLP13].

A k-FIFO queue can be understood as a queue where each element may be dequeued out-of-order up to k−1.

A limitation of this queue is that 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).

Supported policies:

Template Parameters
T
Policieslist of policies to customize the behaviour

Member Function Documentation

◆ try_pop()

template<class T , class... Policies>
bool xenium::kirsch_bounded_kfifo_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

◆ try_push()

template<class T , class... Policies>
bool xenium::kirsch_bounded_kfifo_queue< T, Policies >::try_push ( value_type  value)

Tries to push a new element to the queue.

Progress guarantees: lock-free

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