Logo ROOT   6.16/01
Reference Guide
List of all members | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROOT::Experimental::TTaskGroup Class Reference

A class to manage the asynchronous execution of work items.

A TTaskGroup represents concurrent execution of a group of tasks. Tasks may be dynamically added to the group as it is executing.

A TTaskGroup represents concurrent execution of a group of tasks. Tasks may be dynamically added to the group as it is executing. Nesting TTaskGroup instances may result in a runtime overhead.

Definition at line 21 of file TTaskGroup.hxx.

Public Member Functions

 TTaskGroup ()
 
 TTaskGroup (const TTaskGroup &)=delete
 
 TTaskGroup (TTaskGroup &&other)
 
 ~TTaskGroup ()
 
void Cancel ()
 Cancel all submitted tasks immediately. More...
 
TTaskGroupoperator= (TTaskGroup &&other)
 
void Run (const std::function< void(void)> &closure)
 Add to the group an item of work which will be ran asynchronously. More...
 
void Wait ()
 Wait until all submitted items of work are completed. More...
 

Private Member Functions

void ExecuteInIsolation (const std::function< void(void)> &operation)
 Run operation in the internal task arena to implement work isolation, i.e. More...
 

Private Attributes

std::atomic< bool > fCanRun {true}
 
voidfTaskArena {nullptr}
 
voidfTaskContainer {nullptr}
 

#include <ROOT/TTaskGroup.hxx>

Constructor & Destructor Documentation

◆ TTaskGroup() [1/3]

ROOT::Experimental::TTaskGroup::TTaskGroup ( )

Definition at line 60 of file TTaskGroup.cxx.

◆ TTaskGroup() [2/3]

ROOT::Experimental::TTaskGroup::TTaskGroup ( TTaskGroup &&  other)

Definition at line 71 of file TTaskGroup.cxx.

◆ TTaskGroup() [3/3]

ROOT::Experimental::TTaskGroup::TTaskGroup ( const TTaskGroup )
delete

◆ ~TTaskGroup()

ROOT::Experimental::TTaskGroup::~TTaskGroup ( )

Definition at line 86 of file TTaskGroup.cxx.

Member Function Documentation

◆ Cancel()

void ROOT::Experimental::TTaskGroup::Cancel ( )

Cancel all submitted tasks immediately.

Definition at line 111 of file TTaskGroup.cxx.

◆ ExecuteInIsolation()

void ROOT::Experimental::TTaskGroup::ExecuteInIsolation ( const std::function< void(void)> &  operation)
private

Run operation in the internal task arena to implement work isolation, i.e.

prevent stealing of work items spawned by ancestors.

Definition at line 100 of file TTaskGroup.cxx.

◆ operator=()

TTaskGroup & ROOT::Experimental::TTaskGroup::operator= ( TTaskGroup &&  other)

Definition at line 76 of file TTaskGroup.cxx.

◆ Run()

void ROOT::Experimental::TTaskGroup::Run ( const std::function< void(void)> &  closure)

Add to the group an item of work which will be ran asynchronously.

Adding many small items of work to the TTaskGroup is not efficient, unless they run for long enough. If the work to be done is little, look try to express nested parallelism or resort to other constructs such as the TThreadExecutor. Trying to add a work item to the group while it is in waiting state makes the method block.

Definition at line 128 of file TTaskGroup.cxx.

◆ Wait()

void ROOT::Experimental::TTaskGroup::Wait ( )

Wait until all submitted items of work are completed.

This method is blocking.

Definition at line 143 of file TTaskGroup.cxx.

Member Data Documentation

◆ fCanRun

std::atomic<bool> ROOT::Experimental::TTaskGroup::fCanRun {true}
private

Definition at line 33 of file TTaskGroup.hxx.

◆ fTaskArena

void* ROOT::Experimental::TTaskGroup::fTaskArena {nullptr}
private

Definition at line 32 of file TTaskGroup.hxx.

◆ fTaskContainer

void* ROOT::Experimental::TTaskGroup::fTaskContainer {nullptr}
private

Definition at line 31 of file TTaskGroup.hxx.


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