folly::UnboundedBlockingQueue

A blocking queue with unbounded capacity.

Synopsis

Declared in <folly/executors/task_queue/UnboundedBlockingQueue.h>

template<
    class T,
    class Semaphore = folly::LifoSem>
class UnboundedBlockingQueue
    : public BlockingQueue<T>

Description

Producers never block on add(); consumers block in take() until an item is available. A semaphore tracks the number of queued items.

Base Classes

NameDescription
BlockingQueue<T>Abstract interface for a queue that can block callers until items are available.

Member Functions

NameDescription
UnboundedBlockingQueue [constructor]Construct an empty queue with the given semaphore options.
add Add an item to the queue.
addWithPriority [virtual]Adds item to the queue with the given priority.
getNumPriorities [virtual]Returns the number of priority levels supported by the queue.
size Return an estimate of the number of queued items.
take Remove and return an item, blocking until one is available.
try_take_for Try to remove an item, waiting at most the given duration.

Template Parameters

NameDescription
TThe element type stored in the queue.
SemaphoreThe semaphore type used to signal available items.