#include <userver/concurrent/mpsc_queue.hpp>
Multiple producer, single consumer queue
Definition at line 75 of file mpsc_queue.hpp.
Public Types | |
using | ValueType = T |
using | Producer |
using | Consumer |
using | MultiProducer |
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 |
using concurrent::MpscQueue< T >::Consumer |
Definition at line 97 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::MultiProducer |
Definition at line 99 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::Producer |
Definition at line 95 of file mpsc_queue.hpp.
using concurrent::MpscQueue< T >::ValueType = T |
Definition at line 93 of file mpsc_queue.hpp.
|
inlinestatic |
Create a new queue.
Definition at line 116 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 205 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 198 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 190 of file mpsc_queue.hpp.
size_t concurrent::MpscQueue< T >::GetSizeApproximate | ( | ) | const |
Gets the approximate size of queue.
Definition at line 223 of file mpsc_queue.hpp.
size_t concurrent::MpscQueue< T >::GetSoftMaxSize | ( | ) | const |
Gets the limit on the queue size.
Definition at line 218 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 213 of file mpsc_queue.hpp.
Definition at line 76 of file mpsc_queue.hpp.
Definition at line 76 of file mpsc_queue.hpp.
|
staticconstexpr |
Definition at line 90 of file mpsc_queue.hpp.