|
VLink 2.0.0
A high-performance communication middleware
|
Multi-threaded event loop backed by a pool of worker threads sharing one task queue. More...
Go to the source code of this file.
Classes | |
| class | vlink::MultiLoop |
Multi-threaded variant of MessageLoop running tasks on a worker-thread pool. More... | |
Namespaces | |
| namespace | vlink |
Multi-threaded event loop backed by a pool of worker threads sharing one task queue.
MultiLoop extends MessageLoop by running thread_num worker threads that all dequeue and execute tasks from the same queue. This enables parallel task execution without changing the posting API: callers still call post_task() and exec_task() exactly as with a single-threaded MessageLoop.
Differences from MessageLoop:
is_in_same_thread() returns true if the caller is any of the worker threads.on_begin() and on_end() are called once per worker thread.on_task_changed() is called from the executing worker thread.MultiLoop still fire on one of the worker threads (non-deterministic).