A blocking queue with unbounded capacity.
Declared in <folly/executors/task_queue/UnboundedBlockingQueue.h>
template<
class T,
class Semaphore = folly::LifoSem>
class UnboundedBlockingQueue
: public BlockingQueue<T>
Producers never block on add(); consumers block in take() until an item is available. A semaphore tracks the number of queued items.
| Name | Description |
|---|---|
BlockingQueue<T> | Abstract interface for a queue that can block callers until items are available. |
| Name | Description |
|---|---|
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. |
| Name | Description |
|---|---|
| T | The element type stored in the queue. |
| Semaphore | The semaphore type used to signal available items. |