Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::Core::TaskQueues Class Reference

Manages the set of active task queues in the task manager. More...

Public Member Functions

 TaskQueues ()=default
 Default constructs the TaskQueues instance.
 
TaskQueueoperator[] (TaskQueueId id)
 Retrieve the task queue with the given id.
 
TaskQueueId createQueue (std::string_view name, const size_t numThreads)
 Create a new TaskQueue with the given name.
 

Public Attributes

std::thread::id mainThreadId
 Id of the main thread.
 
std::vector< std::unique_ptr< TaskQueue > > queues
 Map of active task queues.
 
Atomic< TaskQueueIdnextId {0}
 Next available task queue id.
 

Detailed Description

Manages the set of active task queues in the task manager.

Definition at line 698 of file TaskManager.cpp.

Member Function Documentation

◆ createQueue()

TaskQueueId Cogs::Core::TaskQueues::createQueue ( std::string_view  name,
const size_t  numThreads 
)
inline

Create a new TaskQueue with the given name.

Parameters
nameString name used to identify the task queue and to name its worker threads for debugging purposes.
customIdCustom identifier to assign to the queue.
Returns
A task queue id that can be used to retrieve the queue later.

Definition at line 716 of file TaskManager.cpp.

References nextId, and queues.

◆ operator[]()

TaskQueue * Cogs::Core::TaskQueues::operator[] ( TaskQueueId  id)
inline

Retrieve the task queue with the given id.

Definition at line 705 of file TaskManager.cpp.

References queues.

Member Data Documentation

◆ mainThreadId

std::thread::id Cogs::Core::TaskQueues::mainThreadId

Id of the main thread.

Definition at line 729 of file TaskManager.cpp.

◆ nextId

Atomic<TaskQueueId> Cogs::Core::TaskQueues::nextId {0}

Next available task queue id.

Definition at line 735 of file TaskManager.cpp.

Referenced by createQueue().

◆ queues

std::vector<std::unique_ptr<TaskQueue> > Cogs::Core::TaskQueues::queues

Map of active task queues.

Definition at line 732 of file TaskManager.cpp.

Referenced by createQueue(), and operator[]().


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