|
| bool | Dequeue (ItemType &OutItem) |
| | Removes and returns the item from the tail of the queue. 更多...
|
| |
| void | Empty () |
| | Empty the queue, discarding all items. 更多...
|
| |
| bool | Enqueue (const ItemType &Item) |
| | Adds an item to the head of the queue. 更多...
|
| |
| bool | Enqueue (ItemType &&Item) |
| | Adds an item to the head of the queue. 更多...
|
| |
| bool | IsEmpty () const |
| | Checks whether the queue is empty. 更多...
|
| |
| ItemType * | Peek () |
| | Peek at the queue's tail item without removing it. 更多...
|
| |
| bool | Peek (ItemType &OutItem) const |
| | Peeks at the queue's tail item without removing it. 更多...
|
| |
| bool | Pop () |
| | Removes the item from the tail of the queue. 更多...
|
| |
|
| TQueue () |
| | Default constructor.
|
| |
|
| ~TQueue () |
| | Destructor.
|
| |
template<typename ItemType, EQueueMode Mode = EQueueMode::Spsc>
class TQueue< ItemType, Mode >
Template for queues.
This template implements an unbounded non-intrusive queue using a lock-free linked list that stores copies of the queued items. The template can operate in two modes: Multiple-producers single-consumer (MPSC) and Single-producer single-consumer (SPSC).
The queue is thread-safe in both modes. The Dequeue() method ensures thread-safety by writing it in a way that does not depend on possible instruction reordering on the CPU. The Enqueue() method uses an atomic compare-and-swap in multiple-producers scenarios.
- 参数
-
| ItemType | The type of items stored in the queue. |
| Mode | The queue mode (single-producer, single-consumer by default). |
- 待办事项:
- gmp: Implement node pooling.