ST_engine
0.3-ALPHA
|
The Task Manager handles all things multi-threaded in the engine. More...
#include <task_manager.hpp>
Public Member Functions | |
task_manager () | |
task_manager (uint8_t thread_num) | |
~task_manager () | |
task_id | start_task (ST::task *arg) |
void | start_task_lockfree (ST::task *arg) |
void | wait_for_task (task_id id) |
void | work_wait_for_task (task_id id) |
The Task Manager handles all things multi-threaded in the engine.
The task manager only needs to be initialized, it will start at least one worker thread
Definition at line 26 of file task_manager.hpp.
|
explicit |
Initializes the task manager. Starts as many worker threads as there are logical cores in the system - 1.
Definition at line 205 of file task_manager.cpp.
|
explicit |
Initializes the task manager. Starts worker threads equal to thread_num.
msg_bus | A pointer to the global message bus. |
Definition at line 240 of file task_manager.cpp.
task_manager::~task_manager | ( | ) |
Closes the task manager. Waits for all threads to exit properly and finishes any unfinished tasks.
Definition at line 278 of file task_manager.cpp.
Start a new task on one of the task threads.
arg | The task object to use. |
Definition at line 303 of file task_manager.cpp.
void task_manager::start_task_lockfree | ( | ST::task * | arg | ) |
Same as start_task except no task_id (lock) is created and the task has no dependencies.
arg | The task object to use. |
Definition at line 316 of file task_manager.cpp.
void task_manager::wait_for_task | ( | task_id | id | ) |
Wait for a task to finish and do work from the work queue while waiting.
id | The ID of the task. |
Definition at line 341 of file task_manager.cpp.
void task_manager::work_wait_for_task | ( | task_id | id | ) |
Wait for a task to finish and do work from the work queue while waiting.
id | The ID of the task. |
Definition at line 325 of file task_manager.cpp.