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 Sunday, October 02, 2022 at 09:33 AM.

Definition of a helper function:

In [1]:
%%cpp -d

void workItem0()
   printf("Running workItem0...\n");
In [2]:

Create the task group and give work to it

In [3]:
ROOT::Experimental::TTaskGroup tg;

tg.Run([]() { printf("Running workItem1...\n"); });

printf("Running something in the \"main\" thread\n");
Running something in the "main" thread
Running workItem0...
Running workItem1...

Wait until all items are complete

In [4]:

printf("All work completed.\n");
All work completed.

Draw all canvases

In [5]:
%jsroot on