#include <userver/concurrent/queue.hpp>
template<typename T, typename QueuePolicy>
class concurrent::GenericQueue< T, QueuePolicy >
Queue with single and multi producer/consumer options.
- Template Parameters
-
On practice, instead of using GenericQueue
directly, use an alias:
- See also
- concurrent_queues
- Examples
- samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp.
Definition at line 122 of file queue.hpp.
|
static std::shared_ptr< GenericQueue > | Create (std::size_t max_size=kUnbounded) |
| Create a new queue.
|
|
|
static constexpr std::size_t | kUnbounded = std::numeric_limits<std::size_t>::max() / 4 |
|
◆ Consumer
template<typename T , typename QueuePolicy >
◆ MultiConsumer
template<typename T , typename QueuePolicy >
◆ MultiProducer
template<typename T , typename QueuePolicy >
◆ Producer
template<typename T , typename QueuePolicy >
◆ ValueType
template<typename T , typename QueuePolicy >
◆ Create()
template<typename T , typename QueuePolicy >
Create a new queue.
Definition at line 191 of file queue.hpp.
◆ GetConsumer()
template<typename T , typename QueuePolicy >
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 227 of file queue.hpp.
◆ GetMultiConsumer()
template<typename T , typename QueuePolicy >
Get a MultiConsumer
which makes it possible to read items from the queue. Can be called multiple times. The resulting MultiConsumer
is thread-safe, so it can be used simultaneously from multiple coroutines/threads.
- Note
MultiConsumer
may outlive the queue and producers.
-
Prefer
Consumer
tokens when possible, because MultiConsumer
token incurs some overhead.
Definition at line 241 of file queue.hpp.
◆ GetMultiProducer()
template<typename T , typename QueuePolicy >
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 215 of file queue.hpp.
◆ GetProducer()
template<typename T , typename QueuePolicy >
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 201 of file queue.hpp.
◆ GetSizeApproximate()
template<typename T , typename QueuePolicy >
Gets the approximate size of queue.
Definition at line 255 of file queue.hpp.
◆ GetSoftMaxSize()
template<typename T , typename QueuePolicy >
Gets the limit on the queue size.
Definition at line 252 of file queue.hpp.
◆ SetSoftMaxSize()
template<typename T , typename QueuePolicy >
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 249 of file queue.hpp.
◆ Consumer< GenericQueue, ConsumerToken, EmplaceEnabler >
template<typename T , typename QueuePolicy >
◆ Consumer< GenericQueue, MultiConsumerToken, EmplaceEnabler >
template<typename T , typename QueuePolicy >
◆ Producer< GenericQueue, MultiProducerToken, EmplaceEnabler >
template<typename T , typename QueuePolicy >
◆ Producer< GenericQueue, ProducerToken, EmplaceEnabler >
template<typename T , typename QueuePolicy >
◆ kUnbounded
template<typename T , typename QueuePolicy >
constexpr std::size_t concurrent::GenericQueue< T, QueuePolicy >::kUnbounded = std::numeric_limits<std::size_t>::max() / 4 |
|
staticconstexpr |
The documentation for this class was generated from the following file: