ROOT 6.12/07 Reference Guide |
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.
Definition at line 21 of file TTaskGroup.hxx.
Public Member Functions | |
TTaskGroup () | |
TTaskGroup (TTaskGroup &&other) | |
TTaskGroup (const TTaskGroup &)=delete | |
~TTaskGroup () | |
void | Cancel () |
Cancel all submitted tasks immediately. More... | |
TTaskGroup & | operator= (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 Types | |
using | TaskContainerPtr_t = void * |
Private Attributes | |
std::atomic< bool > | fCanRun {true} |
TaskContainerPtr_t | fTaskContainer {nullptr} |
Shield completely from implementation. More... | |
#include <ROOT/TTaskGroup.hxx>
|
private |
Definition at line 31 of file TTaskGroup.hxx.
ROOT::Experimental::TTaskGroup::TTaskGroup | ( | ) |
Definition at line 40 of file TTaskGroup.cxx.
ROOT::Experimental::TTaskGroup::TTaskGroup | ( | TTaskGroup && | other | ) |
Definition at line 50 of file TTaskGroup.cxx.
|
delete |
ROOT::Experimental::TTaskGroup::~TTaskGroup | ( | ) |
Definition at line 63 of file TTaskGroup.cxx.
void ROOT::Experimental::TTaskGroup::Cancel | ( | ) |
Cancel all submitted tasks immediately.
Definition at line 75 of file TTaskGroup.cxx.
TTaskGroup & ROOT::Experimental::TTaskGroup::operator= | ( | TTaskGroup && | other | ) |
Definition at line 55 of file TTaskGroup.cxx.
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 92 of file TTaskGroup.cxx.
void ROOT::Experimental::TTaskGroup::Wait | ( | ) |
Wait until all submitted items of work are completed.
This method is blocking.
Definition at line 107 of file TTaskGroup.cxx.
|
private |
Definition at line 33 of file TTaskGroup.hxx.
|
private |
Shield completely from implementation.
Definition at line 32 of file TTaskGroup.hxx.