#include <userver/concurrent/queue_helpers.hpp>
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
class concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >
Consumer side of concurrent queues.
- Warning
- A single Consumer must not be used from multiple threads concurrently
- See also
- concurrent_queues
Definition at line 110 of file queue_helpers.hpp.
|
|
| Consumer (const Consumer &)=delete |
|
| Consumer (Consumer &&) noexcept=default |
|
Consumer & | operator= (const Consumer &)=delete |
| Consumer & | operator= (Consumer &&other) noexcept |
| bool | Pop (ValueType &value, engine::Deadline deadline={}) const |
| | Pop an element from queue. May wait asynchronously if the queue is empty, but the producer is alive.
|
| bool | PopNoblock (ValueType &value) const |
| | Try to pop an element from queue without blocking. May be used in non-coroutine environment.
|
| void | Reset () && |
| std::shared_ptr< const QueueType > | Queue () const |
| | Const access to source queue.
|
◆ ~Consumer()
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
◆ operator=()
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
| Consumer & concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::operator= |
( |
Consumer< QueueType, ConsumerToken, EmplaceEnablerType > && | other | ) |
|
|
inlinenoexcept |
◆ Pop()
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
Pop an element from queue. May wait asynchronously if the queue is empty, but the producer is alive.
- Returns
- whether something was popped before the deadline or before a task cancellation. false can be returned before the deadline when the producer is no longer alive.
- Warning
- Be careful when using a method in a loop. The engine::Deadline is a wrapper over std::chrono::time_point, not duration! If you need a timeout, you must reconstruct the deadline in the loop.
Definition at line 143 of file queue_helpers.hpp.
◆ PopNoblock()
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
| bool concurrent::Consumer< QueueType, ConsumerToken, EmplaceEnablerType >::PopNoblock |
( |
ValueType & | value | ) |
const |
|
inlinenodiscard |
Try to pop an element from queue without blocking. May be used in non-coroutine environment.
- Returns
- whether something was popped.
Definition at line 153 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 |
|
inlinenodiscard |
◆ Reset()
template<typename QueueType, typename ConsumerToken, typename EmplaceEnablerType>
The documentation for this class was generated from the following file: