12 #ifndef ROC_CORE_MPSC_QUEUE_H_
13 #define ROC_CORE_MPSC_QUEUE_H_
15 #include "roc_core/atomic_ops.h"
43 template <
class TT>
class OwnershipPolicy = RefCountedOwnership,
44 class Node = MpscQueueNode<> >
50 typedef typename OwnershipPolicy<T>::Pointer
Pointer;
74 OwnershipPolicy<T>::acquire(elem);
97 Pointer elem = from_node_data_(data);
98 OwnershipPolicy<T>::release(*elem);
120 Pointer elem = from_node_data_(data);
121 OwnershipPolicy<T>::release(*elem);
128 return static_cast<Node&
>(elem).mpsc_queue_data();
131 static T* from_node_data_(MpscQueueData* data) {
132 return static_cast<T*
>(
static_cast<Node*
>(Node::mpsc_queue_node(data)));
MpscQueueData * pop_front(bool can_spin)
Remove object from the beginning of the queue.
void push_back(MpscQueueData *node)
Add object to the end of the queue.
Thread-safe lock-free node-based intrusive multi-producer single-consumer queue.
OwnershipPolicy< T >::Pointer Pointer
Pointer type.
Pointer try_pop_front_exclusive()
Try to remove object from the beginning of the queue (non-blocking version). Should NOT be called con...
Pointer pop_front_exclusive()
Remove object from the beginning of the queue (blocking version). Should NOT be called concurrently....
void push_back(T &elem)
Add object to the end of the queue. Can be called concurrently. Acquires ownership of elem....
Base class for non-copyable objects.
Multi-producer single-consumer queue internal implementation.
MpscQueue node internal data.