Manages a ThreadPool and eases the synchronization with the managing thread.
More...
Manages a ThreadPool and eases the synchronization with the managing thread.
◆ Scheduler()
nkTasks::Scheduler::Scheduler |
( |
unsigned int |
threadCount = 0 | ) |
|
|
noexcept |
Constructor.
- Parameters
-
threadCount | The number of thread wanted to populate the scheduler's pool. |
◆ ~Scheduler()
nkTasks::Scheduler::~Scheduler |
( |
| ) |
|
◆ getThreadCount()
unsigned int nkTasks::Scheduler::getThreadCount |
( |
| ) |
const |
- Returns
- The number of thread in thie scheduler's pool.
◆ getThread()
Thread* nkTasks::Scheduler::getThread |
( |
unsigned int |
index | ) |
const |
- Parameters
-
index | The index in the pool of wanted thread. |
- Returns
- The thread at given index if available, nullptr if unavailable.
◆ addTask()
Submit a task to the scheduler.
- Parameters
-
◆ resolveTask()
Allows to mark a task as resolved and trigger its post execution callbacks later during the tick method call.
- Parameters
-
◆ cancelPendingTasks()
void nkTasks::Scheduler::cancelPendingTasks |
( |
| ) |
|
◆ tick()
void nkTasks::Scheduler::tick |
( |
| ) |
|
Ticking function for execution. This should be called within the managing thread, which will call the task's onSync methods through this method. Once a thread has finished processing a task, it will mark it as resolved and enqueue it for resolving within the scheduler. This function has to be called to fully resolve tasks that have been marked as ready by the worker threads.
◆ flush()
void nkTasks::Scheduler::flush |
( |
| ) |
|
◆ resizeForThreadCount()
void nkTasks::Scheduler::resizeForThreadCount |
( |
unsigned int |
threadCount | ) |
|
Allows to change the number of threads constituting this scheduler's thread pool.
- Parameters
-
threadCount | The number of threads that should constitute the pool. |
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsTasks/Scheduler/Scheduler.h