|
cxxmcp 1.1.6
C++ MCP SDK
|
Thread pool executor with priority queues and a timer wheel. More...
#include <executor.hpp>
Public Types | |
| using | ExceptionHandler = std::function< void(std::exception_ptr)> |
| using | Options = ExecutorOptions |
Public Member Functions | |
| Executor (Options options={}) | |
| Executor (std::size_t worker_count, std::size_t max_queue_size) | |
| Backward-compatible constructor matching BoundedExecutor's signature. | |
| Executor (std::size_t worker_count, std::size_t max_queue_size, ExceptionHandler exception_handler) | |
| Backward-compatible constructor matching BoundedExecutor's signature. | |
| Executor (const Executor &)=delete | |
| Executor & | operator= (const Executor &)=delete |
| core::Result< Unit > | enqueue (std::function< void()> task) |
| Backward-compatible enqueue (equivalent to post with DEFAULT priority). | |
| core::Result< Unit > | post (std::function< void()> task, TaskPriority prio=TaskPriority::DEFAULT) |
| Post a task for execution at the given priority. | |
| TimerHandle | post_after (std::chrono::milliseconds delay, std::function< void()> task, TaskPriority prio=TaskPriority::DEFAULT) |
| Schedule a task to run after a delay. | |
| TimerHandle | post_at (std::chrono::steady_clock::time_point when, std::function< void()> task, TaskPriority prio=TaskPriority::DEFAULT) |
| Schedule a task to run at an absolute time point. | |
| void | shutdown () noexcept |
| Graceful shutdown: complete all queued tasks, then join threads. | |
| void | stop () |
| Backward-compatible stop (equivalent to shutdown). | |
| void | cancel_and_stop () |
| Cancel pending tasks and stop immediately. | |
Thread pool executor with priority queues and a timer wheel.
The executor owns a fixed number of worker threads and a dedicated timer thread. Worker threads dequeue tasks from three priority-ordered queues. The timer thread sleeps until the next scheduled timer fires and moves due tasks into the appropriate priority queue.