Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::structured_task_group Class Reference

#include <task_group.h>

Public Member Functions

 AZ_CLASS_ALLOCATOR (structured_task_group, ThreadPoolAllocator)
 
 structured_task_group ()
 
 structured_task_group (JobContext *parentContext)
 
template<typename F >
void run (const F &f)
 
template<typename F >
void run_and_wait (const F &f)
 
void wait ()
 
void cancel ()
 
bool is_canceling () const
 

Detailed Description

This is the new pseudo-standard interface for running jobs, can be found in VS2010 and Intel's Threading Building Blocks. It is reasonably efficient, but it uses child jobs to implement the wait() function, which are usually less efficient than explicit dependencies, and can have stack depth issues.

Constructor & Destructor Documentation

◆ structured_task_group() [1/2]

AZ::structured_task_group::structured_task_group ( )
inlineexplicit

This default constructor obtains the parent JobContext from the global context. The parent context can be also specified explicitly.

◆ structured_task_group() [2/2]

AZ::structured_task_group::structured_task_group ( JobContext parentContext)
inline

Differs from the 'standard' in that it requires a context to be specified, we do not have a global default context for jobs.

Member Function Documentation

◆ cancel()

void AZ::structured_task_group::cancel ( )
inline

Cancels all the jobs which were started on this task_group.

◆ is_canceling()

bool AZ::structured_task_group::is_canceling ( ) const
inline

Checks if this task_group has been cancelled.

◆ run()

template<typename F >
void AZ::structured_task_group::run ( const F &  f)
inline

Starts running the specified function asynchronously as a job. The function f should have void return type and take no parameters.

◆ run_and_wait()

template<typename F >
void AZ::structured_task_group::run_and_wait ( const F &  f)
inline

Starts running the specified function asynchronously as a job, and then waits until all the jobs on this structured_task_group have completed. The function f should have void return type and take no parameters. If this is called from within a job then the function will be executed immediately instead of scheduling it.

◆ wait()

void AZ::structured_task_group::wait ( )
inline

Waits until all the jobs started on this task_group have completed. Note that this does not automatically include jobs which were launched by other jobs, unless the job which spawned them also waited for them to complete.


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