Expand description
In-process thread-based task queue with priority and concurrency control.
This crate provides a simple task queue that runs closures on a pool of worker threads. Tasks can be submitted with different priorities, and higher-priority tasks are executed first.
§Example
use philiprehberger_task_queue::{TaskQueue, Priority};
let queue = TaskQueue::new(2);
let handle = queue.submit(|| 1 + 1);
assert_eq!(handle.join().unwrap(), 2);
let handle = queue.submit_with_priority(Priority::High, || "done");
assert_eq!(handle.join().unwrap(), "done");
queue.shutdown();Structs§
- Task
Handle - A handle to a submitted task, used to retrieve the result.
- Task
Queue - A thread-based task queue with configurable concurrency and priority scheduling.
- Task
Queue Stats - Snapshot of task queue statistics for observability.