#include <exkit.hpp>
|
| | Exkit (IScheduler &scheduler) |
| | Construct a new Exkit object. More...
|
| |
| void | run () |
| | Executes all the registered tasks while respecting their dependencies. More...
|
| |
| template<typename DependentType , typename... DependencyTypes> |
| void | add_dependency (TaskHandle< DependentType > &dependent, TaskHandle< DependencyTypes > &... dependencies) |
| | Adds a dependency between a dependent task and one or more dependency tasks. More...
|
| |
| template<typename FunctionType > |
| auto | task (FunctionType &&function) |
| | Creates a new task with the given function. More...
|
| |
| template<typename FunctionType , typename... ResultTypes> |
| auto | task (FunctionType &&function, TaskHandle< ResultTypes > &... dependencies) |
| | Creates a new task with the given function and specified dependencies. More...
|
| |
◆ Exkit()
Construct a new Exkit object.
This constructor initializes the Exkit instance with a specified number of threads for executing tasks. If no thread count is provided, it defaults to the number of hardware threads available on the system, allowing for efficient parallel execution of tasks. The thread pool will be used to manage and execute tasks concurrently while respecting their dependencies
- Parameters
-
| thread_count | The number of threads to use for executing tasks. By default, this is set to the number of hardware threads available on the system |
◆ add_dependency()
template<typename DependentType , typename... DependencyTypes>
| void Exkit::add_dependency |
( |
TaskHandle< DependentType > & |
dependent, |
|
|
TaskHandle< DependencyTypes > &... |
dependencies |
|
) |
| |
Adds a dependency between a dependent task and one or more dependency tasks.
This method is used to specify that a task (the dependent) depends on the completion of one or more other tasks (the dependencies). The dependent task will only be executed after all of its dependencies have been completed. This allows you to create complex task graphs where tasks can depend on the results of other tasks
- Template Parameters
-
| DependentType | The result type of the dependent task |
| DependencyTypes | The result types of the dependency tasks |
- Parameters
-
| dependent | The handle of the dependent task |
| dependencies | The handles of the dependency tasks |
◆ run()
Executes all the registered tasks while respecting their dependencies.
This method is used to start the execution of the tasks. It will block until all tasks have been completed. Tasks will be executed in an order that respects their dependencies, meaning that a task will only be executed after all of its dependencies have been completed. Also depending on the number of available threads, multiple tasks that are ready to execute may be run in parallel
◆ task() [1/2]
template<typename FunctionType >
| auto Exkit::task |
( |
FunctionType && |
function | ) |
|
Creates a new task with the given function.
This method allows you to create a new task that will execute the provided function. The created task will not have any dependencies by default, but you can add dependencies to it later using the add_dependency method. The returned TaskHandle can be used to refer to the created task and its result, and can also be used as a dependency for other tasks
- Template Parameters
-
| FunctionType | The type of the function to be executed as a task |
- Parameters
-
| function | The function to be executed as a task. This can be any callable object, such as a lambda, function pointer, or std::function |
- Returns
- auto A
TaskHandle that can be used to refer to the created task and its result
◆ task() [2/2]
template<typename FunctionType , typename... ResultTypes>
| auto Exkit::task |
( |
FunctionType && |
function, |
|
|
TaskHandle< ResultTypes > &... |
dependencies |
|
) |
| |
Creates a new task with the given function and specified dependencies.
This method allows you to create a new task that depends on the completion of one or more other tasks. The provided function will be executed as a task, but only after all of the specified dependencies have been completed. The function can take the results of the dependency tasks as arguments, which will be automatically passed in when the task is executed
- Template Parameters
-
| FunctionType | The type of the function to be executed as a task |
| ResultTypes | The result types of the dependency tasks |
- Parameters
-
| function | The function to be executed as a task. This can be any callable object, such as a lambda, function pointer, or std::function |
| dependencies | The handles of the tasks that this new task depends on. The new task will only be executed after all of these dependencies have been completed |
- Returns
- auto A
TaskHandle that can be used to refer to the created task and its result
The documentation for this class was generated from the following file: