Pyrogenesis  trunk
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Threading::TaskManager::Impl Class Reference

PImpl-ed implementation of the Task manager. More...

Public Member Functions

 Impl ()=default
 
 ~Impl ()
 
void SetupWorkers (size_t numberOfWorkers)
 2-phase init to avoid having to think too hard about the order of class members. More...
 
void PushTask (std::function< void()> &&task, TaskPriority priority)
 Push a task on the global queue. More...
 

Protected Member Functions

void ClearQueue ()
 
template<TaskPriority Priority>
bool PopTask (std::function< void()> &taskOut)
 

Protected Attributes

std::atomic< bool > m_HasWork = false
 
std::atomic< bool > m_HasLowPriorityWork = false
 
std::mutex m_GlobalMutex
 
std::mutex m_GlobalLowPriorityMutex
 
std::deque< QueueItemm_GlobalQueue
 
std::deque< QueueItemm_GlobalLowPriorityQueue
 
std::deque< WorkerThreadm_Workers
 

Friends

class TaskManager
 
class WorkerThread
 

Detailed Description

PImpl-ed implementation of the Task manager.

The normal priority queue is processed first, the low priority only if there are no higher-priority tasks

Constructor & Destructor Documentation

◆ Impl()

Threading::TaskManager::Impl::Impl ( )
default

◆ ~Impl()

Threading::TaskManager::Impl::~Impl ( )
inline

Member Function Documentation

◆ ClearQueue()

void Threading::TaskManager::Impl::ClearQueue ( )
protected

◆ PopTask()

template<TaskPriority Priority>
bool Threading::TaskManager::Impl::PopTask ( std::function< void()> &  taskOut)
protected

◆ PushTask()

void Threading::TaskManager::Impl::PushTask ( std::function< void()> &&  task,
TaskPriority  priority 
)

Push a task on the global queue.

Takes ownership of task. May be called from any thread.

◆ SetupWorkers()

void Threading::TaskManager::Impl::SetupWorkers ( size_t  numberOfWorkers)

2-phase init to avoid having to think too hard about the order of class members.

Friends And Related Function Documentation

◆ TaskManager

friend class TaskManager
friend

◆ WorkerThread

friend class WorkerThread
friend

Member Data Documentation

◆ m_GlobalLowPriorityMutex

std::mutex Threading::TaskManager::Impl::m_GlobalLowPriorityMutex
protected

◆ m_GlobalLowPriorityQueue

std::deque<QueueItem> Threading::TaskManager::Impl::m_GlobalLowPriorityQueue
protected

◆ m_GlobalMutex

std::mutex Threading::TaskManager::Impl::m_GlobalMutex
protected

◆ m_GlobalQueue

std::deque<QueueItem> Threading::TaskManager::Impl::m_GlobalQueue
protected

◆ m_HasLowPriorityWork

std::atomic<bool> Threading::TaskManager::Impl::m_HasLowPriorityWork = false
protected

◆ m_HasWork

std::atomic<bool> Threading::TaskManager::Impl::m_HasWork = false
protected

◆ m_Workers

std::deque<WorkerThread> Threading::TaskManager::Impl::m_Workers
protected

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