A producer-consumer queue for passing tasks to consumer thread.
Declared in <folly/io/async/AtomicNotificationQueue.h>
template<typename Task>
class AtomicNotificationQueue;
Users of this class are expected to implement functionality to wakeup consumer thread.
| Name | Description |
|---|---|
TryPushResult | Attempts adding a task into the queue. Can be called from any thread. Similarly to push(), producers are expected to notify consumer iff SUCCESS_AND_ARMED is returned. |
| Name | Description |
|---|---|
AtomicNotificationQueue [constructor] | Constructs an empty queue. |
~AtomicNotificationQueue [destructor] | Destroys the queue and any remaining tasks. |
arm | Tries to arm the queue. 1) If the queue was empty: the queue becomes armed and true is returned. 2) Otherwise returns false. Can be called from consumer thread only. |
drive | Executes one round of tasks. Returns true iff tasks were run. Can be called from consumer thread only. |
empty | Checks if the queue is empty. Can be called from consumer thread only. |
getMaxReadAtOnce | Get the maximum number of tasks processed in a single round. Can be called from any thread as long as it's externally synchronized with setMaxReadAtOnce. |
push | push overloads |
setMaxReadAtOnce | Set the maximum number of tasks processed in a single round. Can be called from consumer thread only. |
size | Returns the number of tasks in the queue. Can be called from any thread. |
tryPush | Attempts adding a task into the queue, respecting a size limit. |