userver: concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType > Class Template Reference
Loading...
Searching...
No Matches
concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType > Class Template Referencefinal

#include <userver/concurrent/queue_helpers.hpp>

Detailed Description

template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
class concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >
Warning
A single Consumer must not be used from multiple threads concurrently

Definition at line 96 of file queue_helpers.hpp.

Public Member Functions

 Consumer (const Consumer &)=delete
 
 Consumer (Consumer &&) noexcept=default
 
Consumeroperator= (const Consumer &)=delete
 
Consumeroperator= (Consumer &&other) noexcept
 
bool Pop (ValueType &value, engine::Deadline deadline={}) const
 
bool PopNoblock (ValueType &value) const
 
void Reset () &&
 
std::shared_ptr< const QueueType > Queue () const
 Const access to source queue.
 

Constructor & Destructor Documentation

◆ ~Consumer()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::~Consumer ( )
inline

Definition at line 114 of file queue_helpers.hpp.

Member Function Documentation

◆ operator=()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
Consumer & concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::operator= ( Consumer< QueueType, ConsumerToken, EmplaceEnablerType > && other)
inlinenoexcept

Definition at line 108 of file queue_helpers.hpp.

◆ Pop()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
bool concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::Pop ( ValueType & value,
engine::Deadline deadline = {} ) const
inline

Pop element from queue. May wait asynchronously if the queue is empty, but the producer is alive.

Returns
whether something was popped before the deadline.
Note
false can be returned before the deadline when the producer is no longer alive.

Definition at line 123 of file queue_helpers.hpp.

◆ PopNoblock()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
bool concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::PopNoblock ( ValueType & value) const
inline

Try to pop element from queue without blocking. May be used in non-coroutine environment

Returns
whether something was popped.

Definition at line 131 of file queue_helpers.hpp.

◆ Queue()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
std::shared_ptr< const QueueType > concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::Queue ( ) const
inline

Const access to source queue.

Definition at line 142 of file queue_helpers.hpp.

◆ Reset()

template<typename QueueType , typename ConsumerToken , typename EmplaceEnablerType >
void concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::Reset ( ) &&
inline

Definition at line 135 of file queue_helpers.hpp.


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