Logo ROOT  
Reference Guide
mt301_TTaskGroupSimple.C File Reference

Detailed Description

View in nbviewer Open in SWAN Shows how to run items of work asynchronously with a TTaskGroup.

void workItem0()
{
printf("Running workItem0...\n");
}
void mt301_TTaskGroupSimple()
{
// Create the task group and give work to it
tg.Run(workItem0);
tg.Run([]() { printf("Running workItem1...\n"); });
printf("Running something in the \"main\" thread\n");
// Wait until all items are complete
tg.Wait();
printf("All work completed.\n");
}
Date
August 2017
Author
Danilo Piparo

Definition in file mt301_TTaskGroupSimple.C.

ROOT::Experimental::TTaskGroup::Run
void Run(const std::function< void(void)> &closure)
Add to the group an item of work which will be ran asynchronously.
Definition: TTaskGroup.cxx:107
ROOT::Experimental::TTaskGroup
A class to manage the asynchronous execution of work items.
Definition: TTaskGroup.hxx:33
ROOT::EnableImplicitMT
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Definition: TROOT.cxx:525
ROOT::Experimental::TTaskGroup::Wait
void Wait()
Wait until all submitted items of work are completed.
Definition: TTaskGroup.cxx:122