xenium
|
An unbounded generic lock-free multi-producer/multi-consumer FIFO queue. More...
#include <michael_scott_queue.hpp>
Public Member Functions | |
void | push (T value) |
Pushes the given value to the queue. More... | |
bool | try_pop (T &result) |
Tries to pop an object from the queue. If the operation is successful, the object will be moved to result . More... | |
An unbounded generic lock-free multi-producer/multi-consumer FIFO queue.
This is an implementation of the lock-free MPMC queue proposed by Michael and Scott [MS96]. It is fully generic and can handle any type T
that is copyable or movable.
Supported policies:
xenium::policy::reclaimer
xenium::policy::backoff
xenium::no_backoff
)T | type of the stored elements. |
Policies | list of policies to customize the behaviour |
void xenium::michael_scott_queue< T, Policies >::push | ( | T | value | ) |
Pushes the given value to the queue.
This operation always allocates a new node. Progress guarantees: lock-free (always performs a memory allocation)
value |
bool xenium::michael_scott_queue< T, Policies >::try_pop | ( | T & | result | ) |
Tries to pop an object from the queue. If the operation is successful, the object will be moved to result
.
Progress guarantees: lock-free
result |
true
if the operation was successful, otherwise false