License
Boost Software License, Version 1.0
Lock-free work queue for cross-thread task submission.
This module provides a thread-safe queue for submitting work items from any thread to be processed by a consumer thread. It is designed for use with the EVE runtime to enable cross-thread communication and work distribution.
A work item that can be queued for execution.
Work items wrap a delegate to be executed on the consumer thread.
void delegate() @safe taskThe delegate to execute.string nameOptional name for debugging/logging purposes.this(void delegate() @safe task, string name = null)Construct a work item from a delegate.Status codes for queue operations.
A thread-safe work queue for cross-thread task submission.
The WorkQueue allows multiple producer threads to submit work items that will be consumed by a single consumer thread. It supports both blocking and non-blocking operations.
Example:
auto queue = new WorkQueue();
// Producer thread
queue.push(() @safe { writeln("Hello from consumer!"); });
// Consumer thread
WorkItem item;
if (queue.tryPop(item) == QueueStatus.SUCCESS) {
item.execute();
}WorkItem[] buffersize_t headsize_t tailsize_t countsize_t capacity_bool closed_Mutex mutexCondition notEmptyCondition notFullthis(size_t capacity = 0)Construct a work queue with the specified capacity.