#include <userver/concurrent/queue.hpp>
|
static std::shared_ptr< GenericQueue > | Create (std::size_t max_size=kUnbounded) |
| Create a new queue.
|
|
template<typename T, bool MultipleProducer, bool MultipleConsumer>
class concurrent::GenericQueue< T, MultipleProducer, MultipleConsumer >
Queue with single and multi producer/consumer options
- See also
- Synchronization Primitives
- Examples
- samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp.
Definition at line 36 of file queue.hpp.
◆ Consumer
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ MultiProducer
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ Producer
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ ValueType
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ Create()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Create a new queue.
Definition at line 103 of file queue.hpp.
◆ GetConsumer()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Get a Consumer
which makes it possible to read items from the queue. Can be called multiple times. The resulting Consumer
is not thread-safe, so you have to use multiple Consumer
s of the same queue to simultaneously write from multiple coroutines/threads.
- Note
Consumer
may outlive the queue and producers.
Definition at line 141 of file queue.hpp.
◆ GetMultiProducer()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
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.
- Note
MultiProducer
may outlive the queue and consumers.
-
Prefer
Producer
tokens when possible, because MultiProducer
token incurs some overhead.
Definition at line 128 of file queue.hpp.
◆ GetProducer()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
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.
- Note
Producer
may outlive the queue and consumers.
Definition at line 114 of file queue.hpp.
◆ GetSizeApproximate()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Gets the approximate size of queue.
Definition at line 165 of file queue.hpp.
◆ GetSoftMaxSize()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Gets the limit on the queue size.
Definition at line 162 of file queue.hpp.
◆ NoMoreConsumers()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ NoMoreProducers()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ SetSoftMaxSize()
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Sets the limit on the queue size, pushes over this limit will block.
- Note
- This is a soft limit and may be slightly overrun under load.
Definition at line 157 of file queue.hpp.
◆ Consumer< GenericQueue, EmplaceEnabler >
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ Producer< GenericQueue, MultiProducerToken, EmplaceEnabler >
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ Producer< GenericQueue, ProducerToken, EmplaceEnabler >
template<typename T , bool MultipleProducer, bool MultipleConsumer>
◆ kUnbounded
template<typename T , bool MultipleProducer, bool MultipleConsumer>
Initial value:=
std::numeric_limits<std::size_t>::max() / 4
Definition at line 69 of file queue.hpp.
The documentation for this class was generated from the following file: