15 _producers.push_back(std::make_shared<Producer>(
capacity));
21 for (
const auto& producer : _producers)
22 size += producer->buffer.size();
35 return _producers[index]->buffer.Enqueue(data,
size);
41 for (
size_t i = 0; i < _concurrency; ++i)
44 if (_producers[_consumer++ % _concurrency]->buffer.Dequeue(data, temp))
Locker synchronization primitive.
size_t capacity() const noexcept
Get ring buffer capacity.
MPSCRingBuffer(size_t capacity, size_t concurrency=std::thread::hardware_concurrency())
Default class constructor.
size_t size() const noexcept
Get ring buffer size.
bool Enqueue(const void *data, size_t size)
Enqueue a data into the ring buffer (single producer thread method)
size_t concurrency() const noexcept
Get ring buffer concurrency.
bool Dequeue(void *data, size_t &size)
Dequeue a data from the ring buffer (single consumer thread method)
static uint64_t rdts()
Get the current value of RDTS (Read Time Stamp Counter)
C++ Common project definitions.