|
xenium
|
A bounded lock-free multi-producer/multi-consumer queue. More...
#include <nikolaev_bounded_queue.hpp>
Public Member Functions | |
| nikolaev_bounded_queue (std::size_t capacity) | |
| Constructs a new instance with the specified maximum size. More... | |
| 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... | |
| std::size_t | capacity () const noexcept |
| Returns the (rounded) capacity of the queue. | |
A bounded lock-free multi-producer/multi-consumer queue.
This implementation is based on the bounded MPMC queue proposed by Nikolaev [Nik19].
The nikoleav_bounded_queue provides lock-free progress guarantee under the condition that the number of threads concurrently operating on the queue is less than the queue's capacity.
Supported policies:
xenium::policy::pop_retries| T | |
| Policies | list of policies to customize the behaviour |
|
explicit |
Constructs a new instance with the specified maximum size.
| capacity | max number of elements in the queue; If this is not a power of two, it will be rounded to the next power of two |
| bool xenium::nikolaev_bounded_queue< T, Policies >::try_pop | ( | value_type & | result | ) |
Tries to pop an element from the queue.
Progress guarantees: lock-free
| result |
true if the operation was successful, otherwise false | bool xenium::nikolaev_bounded_queue< T, Policies >::try_push | ( | value_type | value | ) |
Tries to push a new element to the queue.
Progress guarantees: lock-free
| value |
true if the operation was successful, otherwise false
1.8.17