Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::async::SubTaskGraph Class Reference

Dynamic task graph that can be created within the execution of a task. More...

#include <sub_task_graph.hpp>

Public Member Functions

 SubTaskGraph (const SubTaskGraph &)=delete
 SubTaskGraph (SubTaskGraph &&)=default
 ~SubTaskGraph ()=default
SubTaskGraphoperator= (const SubTaskGraph &)=delete
SubTaskGraphoperator= (SubTaskGraph &&)=delete
void Join ()
 Joins the subflow with its parent task.
void Retain (bool flag) noexcept
 Specifies whether to keep the sub task graph after it is joined.
template<StaticTask C>
Task EmplaceTask (C &&callable)
 Creates a static task with the given callable.
template<SubTask C>
Task EmplaceTask (C &&callable)
 Creates a dynamic task (nested subflow) with the given callable.
template<AnyTask... Cs>
requires (sizeof...(Cs) > 1)
auto EmplaceTasks (Cs &&... callables) -> std::array< Task, sizeof...(Cs)>
 Creates multiple tasks from a list of callables.
Task CreatePlaceholder ()
 Creates a placeholder task with no assigned work.
template<std::ranges::range R>
requires std::same_as<std::ranges::range_value_t<R>, Task>
void Linearize (const R &tasks)
 Creates linear dependencies between tasks in the given range.
template<std::ranges::range R, std::invocable< std::ranges::range_reference_t< R > > C>
Task ForEach (const R &range, C &&callable)
 Creates a parallel for-each task over the given range.
template<std::integral I, std::invocable< I > C>
Task ForEachIndex (I start, I end, I step, C &&callable)
 Creates a parallel for-each task over an index range.
template<std::ranges::range InputRange, std::ranges::range OutputRange, std::invocable< std::ranges::range_reference_t< InputRange > > TransformFunc>
Task Transform (const InputRange &input_range, OutputRange &output_range, TransformFunc &&transform_func)
 Creates a parallel transform task that applies a function to each element.
template<std::ranges::range R, typename T, typename BinaryOp>
requires std::invocable<BinaryOp, T, std::ranges::range_reference_t<R>>
Task Reduce (const R &range, T &init, BinaryOp &&binary_op)
 Creates a parallel reduction task that combines elements using a binary operation.
template<std::ranges::random_access_range R, typename Compare = std::less<>>
requires std::predicate<Compare, std::ranges::range_reference_t<R>, std::ranges::range_reference_t<R>>
Task Sort (R &range, Compare &&comparator=Compare{})
 Creates a parallel sort task for the given range.
void RemoveTask (const Task &task)
 Removes a task from this subflow.
template<typename T>
Task ComposedOf (T &other_graph)
 Creates a module task that encapsulates another task graph.
bool Joinable () const noexcept
 Checks if this subflow can be joined.
bool WillBeRetained () const noexcept
 Checks if this subflow will be retained.
auto Run (TaskGraph &graph) -> Future< void >
 Runs a task graph once.
auto Run (TaskGraph &&graph) -> Future< void >
 Runs a task graph once.
template<std::invocable C>
auto Run (TaskGraph &graph, C &&callable) -> Future< void >
 Runs a task graph once and invokes a callback upon completion.
template<std::invocable C>
auto Run (TaskGraph &&graph, C &&callable) -> Future< void >
 Runs a moved task graph once and invokes a callback upon completion.
auto RunN (TaskGraph &graph, size_t count) -> Future< void >
 Runs a task graph for the specified number of times.
auto RunN (TaskGraph &&graph, size_t count) -> Future< void >
 Runs a moved task graph for the specified number of times.
template<std::invocable C>
auto RunN (TaskGraph &graph, size_t count, C &&callable) -> Future< void >
 Runs a task graph for the specified number of times and invokes a callback.
template<std::invocable C>
auto RunN (TaskGraph &&graph, size_t count, C &&callable) -> Future< void >
 Runs a moved task graph for the specified number of times and invokes a callback.
template<std::predicate Predicate>
auto RunUntil (TaskGraph &graph, Predicate &&predicate) -> Future< void >
 Runs a task graph repeatedly until the predicate returns true.
template<std::predicate Predicate>
auto RunUntil (TaskGraph &&graph, Predicate &&predicate) -> Future< void >
 Runs a moved task graph repeatedly until the predicate returns true.
template<std::predicate Predicate, std::invocable C>
auto RunUntil (TaskGraph &graph, Predicate &&predicate, C &&callable) -> Future< void >
 Runs a task graph repeatedly until the predicate returns true, then invokes a callback.
template<std::predicate Predicate, std::invocable C>
auto RunUntil (TaskGraph &&graph, Predicate &&predicate, C &&callable) -> Future< void >
 Runs a moved task graph repeatedly until the predicate returns true, then invokes a callback.
template<std::invocable C>
auto Async (C &&callable) -> std::future< std::invoke_result_t< C > >
 Creates an asynchronous task that runs the given callable.
template<std::invocable C>
auto Async (std::string name, C &&callable) -> std::future< std::invoke_result_t< C > >
 Creates a named asynchronous task that runs the given callable.
template<std::invocable C>
void SilentAsync (C &&callable)
 Creates an asynchronous task without returning a future.
template<std::invocable C>
void SilentAsync (std::string name, C &&callable)
 Creates a named asynchronous task without returning a future.
template<std::invocable C, std::ranges::range Dependencies>
requires std::same_as<std::ranges::range_value_t<Dependencies>, AsyncTask>
auto DependentAsync (C &&callable, const Dependencies &dependencies) -> std::pair< AsyncTask, std::future< std::invoke_result_t< C > > >
 Creates an asynchronous task that runs after specified dependencies complete.
template<std::invocable C, std::ranges::range Dependencies>
requires std::same_as<std::ranges::range_value_t<Dependencies>, AsyncTask>
AsyncTask SilentDependentAsync (C &&callable, const Dependencies &dependencies)
 Creates an asynchronous task that runs after dependencies complete, without returning a future.
void WaitForAll ()
 Blocks until all submitted tasks complete.
void CoRun (TaskGraph &graph)
 Runs a task graph cooperatively and waits until it completes using the current worker thread.
template<std::predicate Predicate>
void CoRunUntil (Predicate &&predicate)
 Keeps the current worker thread running until the predicate returns true.
bool IsWorkerThread () const
 Checks if the current thread is a worker thread of this executor.
int CurrentWorkerId () const
 Gets the ID of the current worker thread.
size_t WorkerCount () const noexcept
 Gets the total number of worker threads.
size_t IdleWorkerCount () const noexcept
 Gets the number of worker threads currently waiting for work.
size_t QueueCount () const noexcept
 Gets the number of task queues in the work-stealing scheduler.
size_t RunningTopologyCount () const
 Gets the number of task graphs currently being executed.

Friends

class TaskGraph
class Executor

Detailed Description

Dynamic task graph that can be created within the execution of a task.

Wraps tf::Subflow and provides methods to create tasks dynamically at runtime. SubTaskGraphs are spawned from the execution of a SubTask and allow for runtime-dependent task creation and dependency management.

Note
Partially thread-safe.
Warning
Only the worker thread that spawned the subflow should modify it.

Definition at line 39 of file sub_task_graph.hpp.

Constructor & Destructor Documentation

◆ SubTaskGraph() [1/2]

helios::async::SubTaskGraph::SubTaskGraph ( const SubTaskGraph & )
delete

◆ SubTaskGraph() [2/2]

helios::async::SubTaskGraph::SubTaskGraph ( SubTaskGraph && )
default

◆ ~SubTaskGraph()

helios::async::SubTaskGraph::~SubTaskGraph ( )
default

Member Function Documentation

◆ Async() [1/2]

template<std::invocable C>
auto helios::async::SubTaskGraph::Async ( C && callable) -> std::future< std::invoke_result_t< C > >
inline

Creates an asynchronous task that runs the given callable.

The task is scheduled immediately and runs independently.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
callableFunction to execute asynchronously
Returns
Future that will hold the result of the execution

Definition at line 443 of file sub_task_graph.hpp.

◆ Async() [2/2]

template<std::invocable C>
auto helios::async::SubTaskGraph::Async ( std::string name,
C && callable ) -> std::future< std::invoke_result_t< C > >
inline

Creates a named asynchronous task that runs the given callable.

The task is scheduled immediately and runs independently.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
nameName for the task (useful for debugging/profiling)
callableFunction to execute asynchronously
Returns
Future that will hold the result of the execution

Definition at line 457 of file sub_task_graph.hpp.

◆ ComposedOf()

template<typename T>
Task helios::async::SubTaskGraph::ComposedOf ( T & other_graph)
inline

Creates a module task that encapsulates another task graph.

Note
Not thread-safe
Parameters
other_graphTask graph to compose into this subflow
Returns
Task handle representing the composed graph

Definition at line 223 of file sub_task_graph.hpp.

◆ CoRun()

void helios::async::SubTaskGraph::CoRun ( TaskGraph & graph)
inline

Runs a task graph cooperatively and waits until it completes using the current worker thread.

Warning
Must be called from within a worker thread of this executor. Triggers assertion if called from a non-worker thread.
Parameters
graphTask graph to execute

Definition at line 702 of file sub_task_graph.hpp.

◆ CoRunUntil()

template<std::predicate Predicate>
void helios::async::SubTaskGraph::CoRunUntil ( Predicate && predicate)
inline

Keeps the current worker thread running until the predicate returns true.

Warning
Must be called from within a worker thread of this executor. Triggers assertion if called from a non-worker thread.
Template Parameters
PredicatePredicate type
Parameters
predicateBoolean predicate to determine when to stop

Definition at line 709 of file sub_task_graph.hpp.

◆ CreatePlaceholder()

Task helios::async::SubTaskGraph::CreatePlaceholder ( )
inline

Creates a placeholder task with no assigned work.

Note
Not thread-safe
Returns
Task handle that can later be assigned work

Definition at line 106 of file sub_task_graph.hpp.

◆ CurrentWorkerId()

int helios::async::SubTaskGraph::CurrentWorkerId ( ) const
inlinenodiscard

Gets the ID of the current worker thread.

Note
Thread-safe.
Returns
Worker ID (0 to N-1) or -1 if not a worker thread

Definition at line 560 of file sub_task_graph.hpp.

◆ DependentAsync()

template<std::invocable C, std::ranges::range Dependencies>
requires std::same_as<std::ranges::range_value_t<Dependencies>, AsyncTask>
auto helios::async::SubTaskGraph::DependentAsync ( C && callable,
const Dependencies & dependencies ) -> std::pair< AsyncTask, std::future< std::invoke_result_t< C > > >
inline

Creates an asynchronous task that runs after specified dependencies complete.

The task will only execute after all dependencies finish.

Note
Thread-safe.
Template Parameters
CCallable type
DependenciesRange type containing AsyncTask dependencies
Parameters
callableFunction to execute asynchronously
dependenciesTasks that must complete before this task runs
Returns
Pair containing AsyncTask handle and Future for the result

Definition at line 659 of file sub_task_graph.hpp.

◆ EmplaceTask() [1/2]

template<SubTask C>
Task helios::async::SubTaskGraph::EmplaceTask ( C && callable)

Creates a dynamic task (nested subflow) with the given callable.

Note
Not thread-safe
Template Parameters
CCallable type that accepts a SubTaskGraph reference
Parameters
callableFunction to execute when the task runs
Returns
Task handle for the created task

◆ EmplaceTask() [2/2]

template<SubTask C>
Task helios::async::SubTaskGraph::EmplaceTask ( C && callable)
inline

Creates a static task with the given callable.

Note
Not thread-safe
Template Parameters
CCallable type
Parameters
callableFunction to execute when the task runs
Returns
Task handle for the created task

Definition at line 74 of file sub_task_graph.hpp.

◆ EmplaceTasks()

template<AnyTask... Cs>
requires (sizeof...(Cs) > 1)
auto helios::async::SubTaskGraph::EmplaceTasks ( Cs &&... callables) -> std::array< Task, sizeof...(Cs)>
inline

Creates multiple tasks from a list of callables.

Note
Not thread-safe
Template Parameters
CsCallable types
Parameters
callablesFunctions to execute when the tasks run
Returns
Array of task handles for the created tasks

Definition at line 97 of file sub_task_graph.hpp.

◆ ForEach()

template<std::ranges::range R, std::invocable< std::ranges::range_reference_t< R > > C>
Task helios::async::SubTaskGraph::ForEach ( const R & range,
C && callable )
inline

Creates a parallel for-each task over the given range.

Note
Not thread-safe
Template Parameters
RRange type
CCallable type
Parameters
rangeInput range to iterate over
callableFunction to apply to each element
Returns
Task handle for the parallel operation

Definition at line 129 of file sub_task_graph.hpp.

◆ ForEachIndex()

template<std::integral I, std::invocable< I > C>
Task helios::async::SubTaskGraph::ForEachIndex ( I start,
I end,
I step,
C && callable )
inline

Creates a parallel for-each task over an index range.

Note
Not thread-safe
Template Parameters
IIntegral type
CCallable type
Parameters
startStarting index (inclusive)
endEnding index (exclusive)
stepStep size
callableFunction to apply to each index
Returns
Task handle for the parallel operation

Definition at line 147 of file sub_task_graph.hpp.

◆ IdleWorkerCount()

size_t helios::async::SubTaskGraph::IdleWorkerCount ( ) const
inlinenodiscardnoexcept

Gets the number of worker threads currently waiting for work.

Note
Thread safe.
Returns
Count of idle workers.

Definition at line 578 of file sub_task_graph.hpp.

◆ IsWorkerThread()

bool helios::async::SubTaskGraph::IsWorkerThread ( ) const
inlinenodiscard

Checks if the current thread is a worker thread of this executor.

Note
Thread safe.
Returns
True if current thread is a worker, false otherwise

Definition at line 553 of file sub_task_graph.hpp.

◆ Join()

void helios::async::SubTaskGraph::Join ( )
inline

Joins the subflow with its parent task.

Called automatically when the SubTaskGraph goes out of scope, unless Join() has already been called.

Warning
Must be called by the same worker thread that created this subflow.

Definition at line 614 of file sub_task_graph.hpp.

◆ Joinable()

bool helios::async::SubTaskGraph::Joinable ( ) const
inlinenodiscardnoexcept

Checks if this subflow can be joined.

A subflow is joinable if it has not yet been joined with its parent task.

Returns
True if the subflow is joinable, false otherwise

Definition at line 233 of file sub_task_graph.hpp.

◆ Linearize()

template<std::ranges::range R>
requires std::same_as<std::ranges::range_value_t<R>, Task>
void helios::async::SubTaskGraph::Linearize ( const R & tasks)
inline

Creates linear dependencies between tasks in the given range.

Note
Not thread-safe
Template Parameters
RRange type containing Task objects
Parameters
tasksRange of tasks to linearize (first->second->third->...)

Definition at line 630 of file sub_task_graph.hpp.

◆ operator=() [1/2]

SubTaskGraph & helios::async::SubTaskGraph::operator= ( const SubTaskGraph & )
delete

◆ operator=() [2/2]

SubTaskGraph & helios::async::SubTaskGraph::operator= ( SubTaskGraph && )
delete

◆ QueueCount()

size_t helios::async::SubTaskGraph::QueueCount ( ) const
inlinenodiscardnoexcept

Gets the number of task queues in the work-stealing scheduler.

Note
Thread safe.
Returns
Count of queues.

Definition at line 587 of file sub_task_graph.hpp.

◆ Reduce()

template<std::ranges::range R, typename T, typename BinaryOp>
requires std::invocable<BinaryOp, T, std::ranges::range_reference_t<R>>
Task helios::async::SubTaskGraph::Reduce ( const R & range,
T & init,
BinaryOp && binary_op )
inline

Creates a parallel reduction task that combines elements using a binary operation.

Note
Not thread-safe
Template Parameters
RRange type
TResult type
BinaryOpBinary operation type
Parameters
rangeRange of elements to reduce
initInitial value and storage for the result
binary_opBinary function to combine elements
Returns
Task handle for the parallel operation

Definition at line 189 of file sub_task_graph.hpp.

◆ RemoveTask()

void helios::async::SubTaskGraph::RemoveTask ( const Task & task)
inline

Removes a task from this subflow.

Note
Not thread-safe
Parameters
taskTask to remove

Definition at line 214 of file sub_task_graph.hpp.

◆ Retain()

void helios::async::SubTaskGraph::Retain ( bool flag)
inlinenoexcept

Specifies whether to keep the sub task graph after it is joined.

By default, a sub task graph is destroyed after being joined. Retaining it allows it to remain valid after being joined.

Warning
Must be called by the same worker thread that created this subflow.
Parameters
flagTrue to retain, false otherwise

Definition at line 64 of file sub_task_graph.hpp.

◆ Run() [1/4]

auto helios::async::SubTaskGraph::Run ( TaskGraph && graph) -> Future< void >
inline

Runs a task graph once.

Note
Thread-safe.
Parameters
graphTask graph to execute (moved)
Returns
Future that completes when execution finishes

Definition at line 264 of file sub_task_graph.hpp.

◆ Run() [2/4]

template<std::invocable C>
auto helios::async::SubTaskGraph::Run ( TaskGraph && graph,
C && callable ) -> Future< void >
inline

Runs a moved task graph once and invokes a callback upon completion.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
graphTask graph to execute (moved)
callableCallback to invoke after execution completes
Returns
Future that completes when execution finishes

Definition at line 294 of file sub_task_graph.hpp.

◆ Run() [3/4]

auto helios::async::SubTaskGraph::Run ( TaskGraph & graph) -> Future< void >
inline

Runs a task graph once.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Parameters
graphTask graph to execute
Returns
Future that completes when execution finishes

Definition at line 254 of file sub_task_graph.hpp.

◆ Run() [4/4]

template<std::invocable C>
auto helios::async::SubTaskGraph::Run ( TaskGraph & graph,
C && callable ) -> Future< void >
inline

Runs a task graph once and invokes a callback upon completion.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
graphTask graph to execute
callableCallback to invoke after execution completes
Returns
Future that completes when execution finishes

Definition at line 280 of file sub_task_graph.hpp.

◆ RunN() [1/4]

auto helios::async::SubTaskGraph::RunN ( TaskGraph && graph,
size_t count ) -> Future< void >
inline

Runs a moved task graph for the specified number of times.

Note
Thread-safe.
Parameters
graphTask graph to execute (moved)
countNumber of times to run the graph
Returns
Future that completes when all executions finish

Definition at line 321 of file sub_task_graph.hpp.

◆ RunN() [2/4]

template<std::invocable C>
auto helios::async::SubTaskGraph::RunN ( TaskGraph && graph,
size_t count,
C && callable ) -> Future< void >
inline

Runs a moved task graph for the specified number of times and invokes a callback.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
graphTask graph to execute (moved)
countNumber of times to run the graph
callableCallback to invoke after all executions complete
Returns
Future that completes when all executions finish

Definition at line 355 of file sub_task_graph.hpp.

◆ RunN() [3/4]

auto helios::async::SubTaskGraph::RunN ( TaskGraph & graph,
size_t count ) -> Future< void >
inline

Runs a task graph for the specified number of times.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Parameters
graphTask graph to execute
countNumber of times to run the graph
Returns
Future that completes when all executions finish

Definition at line 309 of file sub_task_graph.hpp.

◆ RunN() [4/4]

template<std::invocable C>
auto helios::async::SubTaskGraph::RunN ( TaskGraph & graph,
size_t count,
C && callable ) -> Future< void >
inline

Runs a task graph for the specified number of times and invokes a callback.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
graphTask graph to execute
countNumber of times to run the graph
callableCallback to invoke after all executions complete
Returns
Future that completes when all executions finish

Definition at line 339 of file sub_task_graph.hpp.

◆ RunningTopologyCount()

size_t helios::async::SubTaskGraph::RunningTopologyCount ( ) const
inlinenodiscard

Gets the number of task graphs currently being executed.

Note
Thread safe.
Returns
Count of running topologies.

Definition at line 596 of file sub_task_graph.hpp.

◆ RunUntil() [1/4]

template<std::predicate Predicate>
auto helios::async::SubTaskGraph::RunUntil ( TaskGraph && graph,
Predicate && predicate ) -> Future< void >
inline

Runs a moved task graph repeatedly until the predicate returns true.

Note
Thread-safe.
Template Parameters
PredicatePredicate type
Parameters
graphTask graph to execute (moved)
predicateBoolean predicate to determine when to stop
Returns
Future that completes when predicate returns true

Definition at line 386 of file sub_task_graph.hpp.

◆ RunUntil() [2/4]

template<std::predicate Predicate, std::invocable C>
auto helios::async::SubTaskGraph::RunUntil ( TaskGraph && graph,
Predicate && predicate,
C && callable ) -> Future< void >
inline

Runs a moved task graph repeatedly until the predicate returns true, then invokes a callback.

Note
Thread-safe.
Template Parameters
PredicatePredicate type
CCallable type
Parameters
graphTask graph to execute (moved)
predicateBoolean predicate to determine when to stop
callableCallback to invoke after execution completes
Returns
Future that completes when predicate returns true and callback finishes

Definition at line 427 of file sub_task_graph.hpp.

◆ RunUntil() [3/4]

template<std::predicate Predicate>
auto helios::async::SubTaskGraph::RunUntil ( TaskGraph & graph,
Predicate && predicate ) -> Future< void >
inline

Runs a task graph repeatedly until the predicate returns true.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Template Parameters
PredicatePredicate type
Parameters
graphTask graph to execute
predicateBoolean predicate to determine when to stop
Returns
Future that completes when predicate returns true

Definition at line 372 of file sub_task_graph.hpp.

◆ RunUntil() [4/4]

template<std::predicate Predicate, std::invocable C>
auto helios::async::SubTaskGraph::RunUntil ( TaskGraph & graph,
Predicate && predicate,
C && callable ) -> Future< void >
inline

Runs a task graph repeatedly until the predicate returns true, then invokes a callback.

Task graph is not owned - ensure it remains alive during execution.

Note
Thread-safe.
Template Parameters
PredicatePredicate type
CCallable type
Parameters
graphTask graph to execute
predicateBoolean predicate to determine when to stop
callableCallback to invoke after execution completes
Returns
Future that completes when predicate returns true and callback finishes

Definition at line 407 of file sub_task_graph.hpp.

◆ SilentAsync() [1/2]

template<std::invocable C>
void helios::async::SubTaskGraph::SilentAsync ( C && callable)
inline

Creates an asynchronous task without returning a future.

More efficient than Async when you don't need the result.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
callableFunction to execute asynchronously

Definition at line 471 of file sub_task_graph.hpp.

◆ SilentAsync() [2/2]

template<std::invocable C>
void helios::async::SubTaskGraph::SilentAsync ( std::string name,
C && callable )
inline

Creates a named asynchronous task without returning a future.

More efficient than Async when you don't need the result.

Note
Thread-safe.
Template Parameters
CCallable type
Parameters
nameName for the task (useful for debugging/profiling)
callableFunction to execute asynchronously

Definition at line 484 of file sub_task_graph.hpp.

◆ SilentDependentAsync()

template<std::invocable C, std::ranges::range Dependencies>
requires std::same_as<std::ranges::range_value_t<Dependencies>, AsyncTask>
AsyncTask helios::async::SubTaskGraph::SilentDependentAsync ( C && callable,
const Dependencies & dependencies )
inline

Creates an asynchronous task that runs after dependencies complete, without returning a future.

More efficient than DependentAsync when you don't need the result.

Note
Thread-safe.
Template Parameters
CCallable type
DependenciesRange type containing AsyncTask dependencies
Parameters
callableFunction to execute asynchronously
dependenciesTasks that must complete before this task runs
Returns
AsyncTask handle

Definition at line 678 of file sub_task_graph.hpp.

◆ Sort()

template<std::ranges::random_access_range R, typename Compare>
requires std::predicate<Compare, std::ranges::range_reference_t<R>, std::ranges::range_reference_t<R>>
Task helios::async::SubTaskGraph::Sort ( R & range,
Compare && comparator = Compare{} )
inline

Creates a parallel sort task for the given range.

Note
Not thread-safe
Template Parameters
RRandom access range type
CompareComparator type
Parameters
rangeRange of elements to sort
comparatorComparison function (default: std::less<>)
Returns
Task handle for the parallel operation

Definition at line 646 of file sub_task_graph.hpp.

◆ Transform()

template<std::ranges::range InputRange, std::ranges::range OutputRange, std::invocable< std::ranges::range_reference_t< InputRange > > TransformFunc>
Task helios::async::SubTaskGraph::Transform ( const InputRange & input_range,
OutputRange & output_range,
TransformFunc && transform_func )
inline

Creates a parallel transform task that applies a function to each element.

Note
Not thread-safe
Template Parameters
InputRangeInput range type
OutputRangeOutput range type
TransformFuncTransform function type
Parameters
input_rangeRange of input elements
output_rangeRange to store transformed results
transform_funcFunction to apply to each input element
Returns
Task handle for the parallel operation

Definition at line 167 of file sub_task_graph.hpp.

◆ WaitForAll()

void helios::async::SubTaskGraph::WaitForAll ( )
inline

Blocks until all submitted tasks complete.

Waits for all taskflows and async tasks to finish.

Note
Thread-safe.

Definition at line 526 of file sub_task_graph.hpp.

◆ WillBeRetained()

bool helios::async::SubTaskGraph::WillBeRetained ( ) const
inlinenodiscardnoexcept

Checks if this subflow will be retained.

A retained subflow remains valid after being joined.

Returns
True if the subflow will be retained, false otherwise

Definition at line 240 of file sub_task_graph.hpp.

◆ WorkerCount()

size_t helios::async::SubTaskGraph::WorkerCount ( ) const
inlinenodiscardnoexcept

Gets the total number of worker threads.

Note
Thread safe.
Returns
Count of workers.

Definition at line 569 of file sub_task_graph.hpp.

◆ Executor

friend class Executor
friend

Definition at line 611 of file sub_task_graph.hpp.

◆ TaskGraph

friend class TaskGraph
friend

Definition at line 610 of file sub_task_graph.hpp.