|
template<size_t _Index> |
bool | enqueue (T const &t) |
| Enqueue an item using a compile-time producer index.
|
template<size_t _Index, bool _All = true> |
size_t | enqueue (T const *t, size_t const size) |
| Enqueue multiple items using a compile-time producer index.
|
bool | enqueue (size_t const index, T const &t) |
| Enqueue an item using a runtime producer index.
|
template<bool _All = true> |
size_t | enqueue (size_t const index, T const *t, size_t const size) |
| Enqueue multiple items using a runtime producer index.
|
size_t | enqueue (T const &t) |
| Enqueue an item using a random producer index.
|
template<bool _All = true> |
size_t | enqueue (T const *t, size_t const size) |
| Enqueue multiple items using a random producer index.
|
size_t | dequeue (T *ret, size_t size) |
| Dequeue multiple items from all producers.
|
template<typename Func> |
size_t | dequeue (Func const &func, T *ret, size_t const size) |
| Dequeue multiple items with a function to process each item.
|
template<typename Func> |
size_t | consume_all (Func const &func) |
| Process all available items from all producers.
|
auto & | ringOf (size_t const index) |
| Get direct access to a specific producer's ring buffer.
|
| nocopy ()=default |
| Default constructor.
|
| nocopy (nocopy const &)=delete |
| Deleted copy constructor.
|
| nocopy (nocopy const &&)=delete |
| Deleted move constructor.
|
nocopy & | operator= (nocopy const &)=delete |
| Deleted copy assignment operator.
|
nocopy & | operator= (nocopy &&)=delete |
| Deleted move assignment operator.
|
template<typename T, std::size_t max_size, size_t nb_producer = 0>
class qb::lockfree::mpsc::ringbuffer< T, max_size, nb_producer >
Multi-Producer Single-Consumer ring buffer with fixed number of producers.
This implementation provides a lock-free MPSC ring buffer with a compile-time fixed number of producers. Each producer has its own dedicated SPSC ring buffer, eliminating contention between producers.
- Template Parameters
-
T | The type of elements stored in the buffer |
max_size | The maximum capacity per producer buffer |
nb_producer | The number of producers (fixed at compile time) |
template<typename T, std::size_t max_size, size_t nb_producer = 0>
template<bool _All = true>
Enqueue multiple items using a random producer index.
This method automatically selects a producer based on the current time, providing load balancing across producers.
- Template Parameters
-
_All | If true, requires all items to be enqueued or none |
- Parameters
-
t | Array of items to enqueue |
size | Number of items to enqueue |
- Returns
- The number of items successfully enqueued