LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GlobalTaskGroup.h
Go to the documentation of this file.
1 #ifndef art_Utilities_GlobalTaskGroup_h
2 #define art_Utilities_GlobalTaskGroup_h
3 
4 #include "hep_concurrency/WaitingTask.h"
5 #include "tbb/global_control.h"
6 #include "tbb/task_group.h"
7 
8 #include <exception>
9 
10 namespace art {
12  public:
13  GlobalTaskGroup(unsigned n_threads, unsigned stack_size);
14 
15  template <typename T>
16  void
17  run(T&& t)
18  {
19  group_.run(std::move(t));
20  }
21 
22  void may_run(hep::concurrency::WaitingTaskPtr task,
23  std::exception_ptr ex_ptr = {});
24 
25  // Get rid of this!
26  tbb::task_group&
28  {
29  return group_;
30  }
31 
32  private:
33  tbb::global_control threadControl_;
34  tbb::global_control stackSizeControl_;
35  tbb::task_group group_;
36  };
37 }
38 
39 #endif /* art_Utilities_GlobalTaskGroup_h */
40 
41 // Local Variables:
42 // mode: c++
43 // End:
tbb::global_control threadControl_
tbb::global_control stackSizeControl_
GlobalTaskGroup(unsigned n_threads, unsigned stack_size)
tbb::task_group group_
void may_run(hep::concurrency::WaitingTaskPtr task, std::exception_ptr ex_ptr={})
tbb::task_group & native_group()
Definition: MVAAlg.h:12