Class BlockingQueue
Bounded synchronized MPMC FIFO queue.
class BlockingQueue(T)
if (isCopyable!T);
The queue owns fixed runtime-capacity FIFO storage and synchronizes all producer/consumer state through one mutex and condition variable.
Producer admission is non-blocking: tryPush returns full instead of waiting for capacity. Consumer removal is blocking: waitPop sleeps only while the queue is empty and open.
close is idempotent. After close, new pushes are rejected, values already in the queue remain drainable, and all blocked consumers are woken. waitPop returns closed only after the closed queue is empty.
The initial production contract requires copyable T. Move-only synchronized transfer remains a separate lifetime-contract problem.
Construction may allocate the FIFO backing storage and synchronization objects. Queue operations never resize or reacquire the FIFO backing storage.
Constructors
| Name | Description |
|---|---|
this
(capacity)
|
Constructs a queue with fixed runtime capacity. |
Properties
| Name | Type | Description |
|---|---|---|
capacity[get]
|
size_t | Fixed queue capacity selected at construction. |
Methods
| Name | Description |
|---|---|
close
()
|
Closes producer admission and wakes all blocked consumers. |
tryPush
(value)
|
Attempts one producer insertion without waiting for capacity. |
waitPop
()
|
Blocks until a value is available or the closed queue is fully drained. |