Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Threading::TaskManager Class Reference

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
 
TaskManageroperator= (const TaskManager &)=delete
 
TaskManageroperator= (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 TaskManagerInstance ()
 

Private Member Functions

 TaskManager (size_t numberOfWorkers)
 
void DoPushTask (std::function< void()> &&task, TaskPriority priority)
 

Private Attributes

const std::unique_ptr< Implm
 

Friends

class WorkerThread
 

Detailed Description

The task manager creates all worker threads on initialisation, and manages the task queues.

See implementation for additional comments.

Constructor & Destructor Documentation

◆ TaskManager() [1/4]

Threading::TaskManager::TaskManager ( )

◆ ~TaskManager()

Threading::TaskManager::~TaskManager ( )
default

◆ TaskManager() [2/4]

Threading::TaskManager::TaskManager ( const TaskManager )
delete

◆ TaskManager() [3/4]

Threading::TaskManager::TaskManager ( TaskManager &&  )
delete

◆ TaskManager() [4/4]

Threading::TaskManager::TaskManager ( size_t  numberOfWorkers)
private

Member Function Documentation

◆ ClearQueue()

void Threading::TaskManager::ClearQueue ( )

Clears all tasks from the queue.

This blocks on started tasks.

◆ DoPushTask()

void Threading::TaskManager::DoPushTask ( std::function< void()> &&  task,
TaskPriority  priority 
)
private

◆ GetNumberOfWorkers()

size_t Threading::TaskManager::GetNumberOfWorkers ( ) const
Returns
the number of threaded workers.

◆ Initialise()

void Threading::TaskManager::Initialise ( )
static

◆ Instance()

TaskManager & Threading::TaskManager::Instance ( )
static

◆ operator=() [1/2]

TaskManager & Threading::TaskManager::operator= ( const TaskManager )
delete

◆ operator=() [2/2]

TaskManager & Threading::TaskManager::operator= ( TaskManager &&  )
delete

◆ PushTask()

template<typename T >
Future< std::invoke_result_t< T > > Threading::TaskManager::PushTask ( T &&  func,
TaskPriority  priority = TaskPriority::NORMAL 
)
inline

Push a task to be executed.

Friends And Related Function Documentation

◆ WorkerThread

friend class WorkerThread
friend

Member Data Documentation

◆ m

const std::unique_ptr<Impl> Threading::TaskManager::m
private

The documentation for this class was generated from the following files: