Abstract interface for a queue that can block callers until items are available.

Synopsis

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

template<class T>
class BlockingQueue;

Member Functions

Name

Description

~BlockingQueue [destructor] [virtual]

Destroy the queue.

add [virtual]

Adds 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 [virtual]

Returns the number of items currently in the queue.

take [virtual]

Removes and returns an item from the queue, blocking until one is available.

try_take_for [virtual]

Removes and returns an item from the queue, waiting up to the given time.

Derived Classes

Name

Description

LifoSemMPMCQueue

A blocking multi‐producer, multi‐consumer queue backed by a LIFO semaphore.

PriorityLifoSemMPMCQueue

A blocking queue with priority levels backed by per‐priority MPMC queues and a LIFO semaphore.

PriorityUnboundedBlockingQueue

A blocking queue with a fixed number of priority levels.

StoppedThreadQueue

Blocking queue holding threads that have stopped and await joining.

StripedPriorityUnboundedBlockingQueue

A BlockingQueue sharded by LLC cache. Compared to the default PriorityUnboundedBlockingQueue, this can reduce contention on systems with a large number of LLC caches, at the cost of unfairness and work conservation; see the StripedThrottledLifoSem documentation for a detailed explanation.

UnboundedBlockingQueue

A blocking queue with unbounded capacity.

Created with MrDocs