ORIGINAL
|
Thread pool for managing and executing tasks with priority. More...
#include <tasks.h>
Public Types | |
enum class | priority : u_integer { IMMEDIATE = 0 , HIGH = 1 , NORMAL = 2 , LOW = 3 , DEFERRED = 4 } |
Task priority levels for execution scheduling. More... | |
Public Member Functions | |
taskDelegator (u_integer thread_cnt=8) | |
Constructs a task delegator with specified thread count. | |
template<typename Callback , typename... Args> | |
auto | submit (Callback &&c, Args &&... args) |
Submits a task with normal priority. | |
template<typename Callback , typename... Args> | |
auto | submit (priority priority, Callback &&c, Args &&... args) |
Submits a task with specified priority. | |
template<typename TYPE > | |
async::future< TYPE > | submit (strongPtr< task< TYPE > > &t) |
Submits a pre-created task with normal priority. | |
template<typename TYPE > | |
async::future< TYPE > | submit (priority priority, strongPtr< task< TYPE > > &t) |
Submits a pre-created task with specified priority. | |
void | runDeferred () |
Moves one deferred task to the waiting queue. | |
void | runAllDeferred () |
Moves all deferred tasks to the waiting queue. | |
void | stop () |
Stops the task delegator and waits for completion. | |
u_integer | activeThreads () const noexcept |
Gets the number of active threads. | |
u_integer | idleThreads () const noexcept |
Gets the number of idle threads. | |
~taskDelegator () | |
Destructor - automatically stops if not already stopped. | |
template<typename TYPE > | |
original::async::future< TYPE > | submit (strongPtr< task< TYPE > > &t) |
template<typename TYPE > | |
original::async::future< TYPE > | submit (const priority priority, strongPtr< task< TYPE > > &t) |
Thread pool for managing and executing tasks with priority.
Provides a managed thread pool with task prioritization, deferred execution, and resource monitoring
|
strong |
|
inlineexplicit |
Constructs a task delegator with specified thread count.
thread_cnt | Number of worker threads (default: 8) |
|
inlinenoexcept |
Gets the number of active threads.
|
inlinenoexcept |
Gets the number of idle threads.
auto original::taskDelegator::submit | ( | Callback && | c, |
Args &&... | args ) |
Submits a task with normal priority.
Callback | Type of the callable |
Args | Types of the arguments |
c | Callable to execute |
args | Arguments to forward to the callable |
auto original::taskDelegator::submit | ( | priority | priority, |
Callback && | c, | ||
Args &&... | args ) |
Submits a task with specified priority.
Callback | Type of the callable |
Args | Types of the arguments |
priority | Task priority level |
c | Callable to execute |
args | Arguments to forward to the callable |
async::future< TYPE > original::taskDelegator::submit | ( | priority | priority, |
strongPtr< task< TYPE > > & | t ) |
Submits a pre-created task with specified priority.
TYPE | Task result type |
priority | Task priority level |
t | Shared pointer to the task |
async::future< TYPE > original::taskDelegator::submit | ( | strongPtr< task< TYPE > > & | t | ) |
Submits a pre-created task with normal priority.
TYPE | Task result type |
t | Shared pointer to the task |