Shows how to run items of work asynchronously with a TTaskGroup.
Author: Danilo Piparo
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Thursday, February 25, 2021 at 09:34 AM.
A helper function is created:
%%cpp -d
void workItem0()
{
printf("Running workItem0...\n");
}
ROOT::EnableImplicitMT(4);
Create the task group and give work to it
ROOT::Experimental::TTaskGroup tg;
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");
Draw all canvases
%jsroot on
gROOT->GetListOfCanvases()->Draw()