ROOT
master
Reference Guide
Loading...
Searching...
No Matches
mt301_TTaskGroupSimple.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_legacy
3
/// Shows how to run items of work asynchronously with a TTaskGroup.
4
///
5
/// \macro_code
6
///
7
/// \date August 2017
8
/// \author Danilo Piparo
9
10
void
workItem0
()
11
{
12
printf
(
"Running workItem0...\n"
);
13
}
14
15
void
mt301_TTaskGroupSimple
()
16
{
17
18
ROOT::EnableImplicitMT
(4);
19
20
// Create the task group and give work to it
21
ROOT::Experimental::TTaskGroup
tg
;
22
23
tg
.Run(
workItem0
);
24
tg
.Run([]() {
printf
(
"Running workItem1...\n"
); });
25
26
printf
(
"Running something in the \"main\" thread\n"
);
27
28
// Wait until all items are complete
29
tg
.Wait();
30
31
printf
(
"All work completed.\n"
);
32
}
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
ROOT::Experimental::TTaskGroup
A class to manage the asynchronous execution of work items.
Definition
TTaskGroup.hxx:26
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:539
tutorials
legacy
multicore
mt301_TTaskGroupSimple.C
ROOT master - Reference Guide Generated on Sun Feb 16 2025 04:44:24 (GVA Time) using Doxygen 1.10.0