folly::PriorityUnboundedQueueSet

PriorityUnboundedQueueSet

Synopsis

Declared in <folly/concurrency/PriorityUnboundedQueueSet.h>

template<
    typename T,
    bool SingleProducer,
    bool SingleConsumer,
    bool MayBlock,
    size_t LgSegmentSize = 8,
    size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
    template<typename> typename Atom = atomic>
class PriorityUnboundedQueueSet;

Description

A set of per-priority queues, and an interface for accessing them.

Functions: Consumer operations: bool try_dequeue(T&); Optional<T> try_dequeue(); Tries to extract an element from the front of the least-priority backing queue which has an element, if any. T const* try_peek(); Returns a pointer to the element at the front of the least-priority backing queue which has an element, if any. Only allowed when SingleConsumer is true. Note: Queues at lower priority are tried before queues at higher priority.

Secondary functions: queue& at_priority(size_t); queue const& at_priority(size_t) const; Returns a reference to the owned queue at the given priority. size_t size() const; Returns an estimate of the total size of the owned queues. bool empty() const; Returns true only if all of the owned queues were empty during the call. Note: size() and empty() are guaranteed to be accurate only if the owned queues are not changed concurrently.

Type Aliases

NameDescription
queue The backing unbounded queue type used for each priority.

Member Functions

NameDescription
PriorityUnboundedQueueSet [constructor]Constructors
operator= Assignment operators
at_priority Returns the owned queue at the given priority.
empty Checks whether all owned queues were empty during the call.
priorities Returns the number of priority queues in the set.
size Returns an estimate of the total number of elements across all queues.
try_dequeue try_dequeue overloads
try_peek Returns a pointer to the front element of the least-priority non-empty queue.