|
VLink 2.0.0
A high-performance communication middleware
|
General-purpose thread pool for parallel task execution. More...
#include <functional>#include <future>#include <memory>#include <string>#include <utility>#include "./macros.h"Go to the source code of this file.
Classes | |
| class | vlink::ThreadPool |
| Fixed-size thread pool for parallel task execution. More... | |
Namespaces | |
| namespace | vlink |
General-purpose thread pool for parallel task execution.
ThreadPool maintains a fixed number of worker threads that dequeue and execute tasks posted via post_task() or invoke_task(). Unlike MessageLoop, there is no timer support or loop lifecycle; the pool is started on construction and shut down with shutdown().
Queue types:
| Type | Queue implementation | Notes |
|---|---|---|
kNormalType | Mutex-protected std::queue | Default |
kLockfreeType | MpmcQueue (lock-free MPMC) | Lower overhead under contention |
Idle strategies (same semantics as MessageLoop::Strategy).
invoke_task() returns a std::future. Blocking on the future from a thread pool worker will deadlock if all workers are busy.is_in_work_thread() can be used to detect reentrant calls.