#include <userver/concurrent/mpsc_queue.hpp>
Multiple producer, single consumer queue
Definition at line 44 of file mpsc_queue.hpp.
Public Types | |
using | ValueType = T |
using | Producer = concurrent::Producer<MpscQueue, ProducerToken, EmplaceEnabler> |
using | Consumer = concurrent::Consumer<MpscQueue, ConsumerToken, EmplaceEnabler> |
using | MultiProducer = concurrent::Producer<MpscQueue, impl::NoToken, EmplaceEnabler> |
Public Member Functions | |
Producer | GetProducer () |
MultiProducer | GetMultiProducer () |
Consumer | GetConsumer () |
void | SetSoftMaxSize (size_t size) |
Sets the limit on the queue size, pushes over this limit will block. | |
size_t | GetSoftMaxSize () const |
Gets the limit on the queue size. | |
size_t | GetSizeApproximate () const |
Gets the approximate size of queue. | |
Static Public Member Functions | |
static std::shared_ptr< MpscQueue > | Create (std::size_t max_size=kUnbounded) |
Create a new queue. | |
Static Public Attributes | |
static constexpr std::size_t | kUnbounded = std::numeric_limits<std::size_t>::max() |
using concurrent::MpscQueue< T >::Consumer = concurrent::Consumer<MpscQueue, ConsumerToken, EmplaceEnabler> |
Definition at line 64 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::MultiProducer = concurrent::Producer<MpscQueue, impl::NoToken, EmplaceEnabler> |
Definition at line 65 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::Producer = concurrent::Producer<MpscQueue, ProducerToken, EmplaceEnabler> |
Definition at line 63 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::ValueType = T |
Definition at line 61 of file mpsc_queue.hpp.
|
inlinestatic |
Create a new queue.
Definition at line 80 of file mpsc_queue.hpp.
MpscQueue< T >::Consumer concurrent::MpscQueue< T >::GetConsumer | ( | ) |
Get a Consumer
which makes it possible to read items from the queue. Can be called only once. You may not use the Consumer
simultaneously from multiple coroutines/threads.
Consumer
may outlive the queue and producers. Definition at line 169 of file mpsc_queue.hpp.
MpscQueue< T >::MultiProducer concurrent::MpscQueue< T >::GetMultiProducer | ( | ) |
Get a MultiProducer
which makes it possible to push items into the queue. Can be called multiple times. The resulting MultiProducer
is thread-safe, so it can be used simultaneously from multiple coroutines/threads.
MultiProducer
may outlive the queue and the Consumer
. Definition at line 162 of file mpsc_queue.hpp.
MpscQueue< T >::Producer concurrent::MpscQueue< T >::GetProducer | ( | ) |
Get a Producer
which makes it possible to push items into the queue. Can be called multiple times. The resulting Producer
is not thread-safe, so you have to use multiple Producers of the same queue to simultaneously write from multiple coroutines/threads.
Definition at line 154 of file mpsc_queue.hpp.
size_t concurrent::MpscQueue< T >::GetSizeApproximate | ( | ) | const |
Gets the approximate size of queue.
Definition at line 186 of file mpsc_queue.hpp.
size_t concurrent::MpscQueue< T >::GetSoftMaxSize | ( | ) | const |
Gets the limit on the queue size.
Definition at line 181 of file mpsc_queue.hpp.
void concurrent::MpscQueue< T >::SetSoftMaxSize | ( | size_t | size | ) |
Sets the limit on the queue size, pushes over this limit will block.
Definition at line 176 of file mpsc_queue.hpp.
Definition at line 45 of file mpsc_queue.hpp.
Definition at line 45 of file mpsc_queue.hpp.
|
staticconstexpr |
Definition at line 59 of file mpsc_queue.hpp.