Logo ROOT  
Reference Guide
TTaskGroup.hxx
Go to the documentation of this file.
1// @(#)root/thread:$Id$
2// Author: Danilo Piparo August 2017
3
4/*************************************************************************
5 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TTaskGroup
13#define ROOT_TTaskGroup
14
15#include <atomic>
16#include <functional>
17
18namespace ROOT {
19namespace Experimental {
20
22 /**
23 \class ROOT::Experimental::TTaskGroup
24 \ingroup Parallelism
25 \brief A class to manage the asynchronous execution of work items.
26
27 A TTaskGroup represents concurrent execution of a group of tasks. Tasks may be dynamically added to the group as it
28 is executing.
29 */
30private:
31 void *fTaskContainer{nullptr};
32 std::atomic<bool> fCanRun{true};
33 void ExecuteInIsolation(const std::function<void(void)> &operation);
34
35public:
36 TTaskGroup();
37 TTaskGroup(TTaskGroup &&other);
38 TTaskGroup(const TTaskGroup &) = delete;
41
42 void Cancel();
43 void Run(const std::function<void(void)> &closure);
44 void Wait();
45};
46} // namespace Experimental
47} // namespace ROOT
48
49#endif
A class to manage the asynchronous execution of work items.
Definition: TTaskGroup.hxx:21
void ExecuteInIsolation(const std::function< void(void)> &operation)
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
void Wait()
Wait until all submitted items of work are completed.
Definition: TTaskGroup.cxx:122
void Cancel()
Cancel all submitted tasks immediately.
Definition: TTaskGroup.cxx:90
TTaskGroup(const TTaskGroup &)=delete
TTaskGroup & operator=(TTaskGroup &&other)
Definition: TTaskGroup.cxx:70
std::atomic< bool > fCanRun
Definition: TTaskGroup.hxx:32
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21