Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
The task manager creates all worker threads on initialisation, and manages the task queues. More...
#include <TaskManager.h>
Classes | |
class | Impl |
PImpl-ed implementation of the Task manager. More... | |
Public Member Functions | |
TaskManager () | |
~TaskManager () | |
TaskManager (const TaskManager &)=delete | |
TaskManager (TaskManager &&)=delete | |
TaskManager & | operator= (const TaskManager &)=delete |
TaskManager & | operator= (TaskManager &&)=delete |
void | ClearQueue () |
Clears all tasks from the queue. More... | |
size_t | GetNumberOfWorkers () const |
template<typename T > | |
Future< std::invoke_result_t< T > > | PushTask (T &&func, TaskPriority priority=TaskPriority::NORMAL) |
Push a task to be executed. More... | |
Static Public Member Functions | |
static void | Initialise () |
static TaskManager & | Instance () |
Private Member Functions | |
TaskManager (size_t numberOfWorkers) | |
void | DoPushTask (std::function< void()> &&task, TaskPriority priority) |
Private Attributes | |
const std::unique_ptr< Impl > | m |
Friends | |
class | WorkerThread |
The task manager creates all worker threads on initialisation, and manages the task queues.
See implementation for additional comments.
Threading::TaskManager::TaskManager | ( | ) |
|
default |
|
delete |
|
delete |
|
private |
void Threading::TaskManager::ClearQueue | ( | ) |
Clears all tasks from the queue.
This blocks on started tasks.
|
private |
size_t Threading::TaskManager::GetNumberOfWorkers | ( | ) | const |
|
static |
|
static |
|
delete |
|
delete |
|
inline |
Push a task to be executed.
|
friend |
|
private |