userver: concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide Class Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide Class Referencefinal

Your opinion will help to improve our service

Leave a feedback >

Detailed Description

template<typename T, typename QueuePolicy>
class concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide

Definition at line 474 of file queue.hpp.

+ Inheritance diagram for concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide:

Public Types

using ValueType
 
using Producer
 
using Consumer
 
using MultiProducer
 
using MultiConsumer
 

Public Member Functions

 MultiProducerSide (GenericQueue &queue, std::size_t capacity)
 
template<typename Token>
bool Push (Token &token, T &&value, engine::Deadline deadline, std::size_t value_size)
 
template<typename Token>
bool PushNoblock (Token &token, T &&value, std::size_t value_size)
 
void OnElementPopped (std::size_t value_size)
 
void StopBlockingOnPush ()
 
void ResumeBlockingOnPush ()
 
void SetSoftMaxSize (std::size_t count)
 
std::size_t GetSizeApproximate () const noexcept
 
std::size_t GetSoftMaxSize () const noexcept
 
Producer GetProducer ()
 
MultiProducer GetMultiProducer ()
 
Consumer GetConsumer ()
 
MultiConsumer GetMultiConsumer ()
 
void SetSoftMaxSize (std::size_t max_size)
 Sets the limit on the queue size, pushes over this limit will block.
 
std::size_t GetSoftMaxSize () const
 Gets the limit on the queue size.
 
std::size_t GetSizeApproximate () const
 Gets the approximate size of queue.
 

Static Public Member Functions

static std::shared_ptr< GenericQueueCreate (std::size_t max_size=kUnbounded)
 Create a new queue.
 

Static Public Attributes

static constexpr std::size_t kUnbounded
 

Member Typedef Documentation

◆ Consumer

using concurrent::GenericQueue< T, QueuePolicy >::Consumer

Definition at line 154 of file queue.hpp.

◆ MultiConsumer

using concurrent::GenericQueue< T, QueuePolicy >::MultiConsumer

Definition at line 156 of file queue.hpp.

◆ MultiProducer

using concurrent::GenericQueue< T, QueuePolicy >::MultiProducer

Definition at line 155 of file queue.hpp.

◆ Producer

using concurrent::GenericQueue< T, QueuePolicy >::Producer

Definition at line 153 of file queue.hpp.

◆ ValueType

using concurrent::GenericQueue< T, QueuePolicy >::ValueType

Definition at line 151 of file queue.hpp.

Constructor & Destructor Documentation

◆ MultiProducerSide()

template<typename T, typename QueuePolicy>
concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::MultiProducerSide ( GenericQueue & queue,
std::size_t capacity )
inline

Definition at line 476 of file queue.hpp.

Member Function Documentation

◆ Create()

static std::shared_ptr< GenericQueue > concurrent::GenericQueue< T, QueuePolicy >::Create ( std::size_t max_size = kUnbounded)
inlinestatic

Create a new queue.

Definition at line 191 of file queue.hpp.

◆ GetConsumer()

Consumer concurrent::GenericQueue< T, QueuePolicy >::GetConsumer ( )
inline

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 Consumers 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()

MultiConsumer concurrent::GenericQueue< T, QueuePolicy >::GetMultiConsumer ( )
inline

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()

MultiProducer concurrent::GenericQueue< T, QueuePolicy >::GetMultiProducer ( )
inline

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()

Producer concurrent::GenericQueue< T, QueuePolicy >::GetProducer ( )
inline

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() [1/2]

std::size_t concurrent::GenericQueue< T, QueuePolicy >::GetSizeApproximate ( ) const
inline

Gets the approximate size of queue.

Definition at line 255 of file queue.hpp.

◆ GetSizeApproximate() [2/2]

template<typename T, typename QueuePolicy>
std::size_t concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::GetSizeApproximate ( ) const
inlinenoexcept

Definition at line 500 of file queue.hpp.

◆ GetSoftMaxSize() [1/2]

std::size_t concurrent::GenericQueue< T, QueuePolicy >::GetSoftMaxSize ( ) const
inline

Gets the limit on the queue size.

Definition at line 252 of file queue.hpp.

◆ GetSoftMaxSize() [2/2]

template<typename T, typename QueuePolicy>
std::size_t concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::GetSoftMaxSize ( ) const
inlinenoexcept

Definition at line 502 of file queue.hpp.

◆ OnElementPopped()

template<typename T, typename QueuePolicy>
void concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::OnElementPopped ( std::size_t value_size)
inline

Definition at line 492 of file queue.hpp.

◆ Push()

template<typename T, typename QueuePolicy>
template<typename Token>
bool concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::Push ( Token & token,
T && value,
engine::Deadline deadline,
std::size_t value_size )
inlinenodiscard

Definition at line 482 of file queue.hpp.

◆ PushNoblock()

template<typename T, typename QueuePolicy>
template<typename Token>
bool concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::PushNoblock ( Token & token,
T && value,
std::size_t value_size )
inlinenodiscard

Definition at line 488 of file queue.hpp.

◆ ResumeBlockingOnPush()

template<typename T, typename QueuePolicy>
void concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::ResumeBlockingOnPush ( )
inline

Definition at line 496 of file queue.hpp.

◆ SetSoftMaxSize() [1/2]

template<typename T, typename QueuePolicy>
void concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::SetSoftMaxSize ( std::size_t count)
inline

Definition at line 498 of file queue.hpp.

◆ SetSoftMaxSize() [2/2]

void concurrent::GenericQueue< T, QueuePolicy >::SetSoftMaxSize ( std::size_t max_size)
inline

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.

◆ StopBlockingOnPush()

template<typename T, typename QueuePolicy>
void concurrent::GenericQueue< T, QueuePolicy >::MultiProducerSide::StopBlockingOnPush ( )
inline

Definition at line 494 of file queue.hpp.

Friends And Related Symbol Documentation

◆ Consumer< GenericQueue, ConsumerToken, EmplaceEnabler >

friend class Consumer< GenericQueue, ConsumerToken, EmplaceEnabler >
friend

Definition at line 133 of file queue.hpp.

◆ Consumer< GenericQueue, MultiConsumerToken, EmplaceEnabler >

friend class Consumer< GenericQueue, MultiConsumerToken, EmplaceEnabler >
friend

Definition at line 133 of file queue.hpp.

◆ Producer< GenericQueue, MultiProducerToken, EmplaceEnabler >

friend class Producer< GenericQueue, MultiProducerToken, EmplaceEnabler >
friend

Definition at line 133 of file queue.hpp.

◆ Producer< GenericQueue, ProducerToken, EmplaceEnabler >

friend class Producer< GenericQueue, ProducerToken, EmplaceEnabler >
friend

Definition at line 133 of file queue.hpp.

Member Data Documentation

◆ kUnbounded

std::size_t concurrent::GenericQueue< T, QueuePolicy >::kUnbounded
staticconstexpr

Definition at line 158 of file queue.hpp.


The documentation for this class was generated from the following file: