|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
Lock-free task queue with a fixed worker thread pool and backpressure. More...
#include <request_queue.h>
Classes | |
| struct | Stats |
| Runtime statistics for monitoring queue health. More... | |
Public Member Functions | |
| RequestQueue (size_t num_workers=128, size_t max_queue_size=10000) | |
| Construct a request queue with a worker thread pool. | |
| Stats | stats () const |
| Get current queue statistics. | |
| template<typename F > | |
| std::pair< bool, std::future< void > > | submit (F &&task) |
| Submit a task to the queue. | |
| ~RequestQueue () | |
| Destructor: stops all workers and waits for them to finish. | |
Lock-free task queue with a fixed worker thread pool and backpressure.
Tasks are submitted via submit() and executed asynchronously by worker threads. When the queue is full, new tasks are rejected (backpressure).
Definition at line 35 of file request_queue.h.
|
inline |
Construct a request queue with a worker thread pool.
| num_workers | Number of worker threads to spawn (default: 128). |
| max_queue_size | Maximum number of pending tasks before backpressure (default: 10000). |
Definition at line 52 of file request_queue.h.
|
inline |
Get current queue statistics.
Definition at line 117 of file request_queue.h.
|
inline |
Submit a task to the queue.
If the queue is full (pending >= max_queue_size), the task is rejected and the rejected counter is incremented.
| F | Callable type (must be invocable with no arguments). |
| task | The task to execute. |
Definition at line 89 of file request_queue.h.