LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GlobalTaskGroup.cc
Go to the documentation of this file.
2 
3 art::GlobalTaskGroup::GlobalTaskGroup(unsigned const n_threads,
4  unsigned const stack_size)
5  : threadControl_{tbb::global_control::max_allowed_parallelism, n_threads}
6  , stackSizeControl_{tbb::global_control::thread_stack_size, stack_size}
7 {}
8 
9 void
10 art::GlobalTaskGroup::may_run(hep::concurrency::WaitingTaskPtr task,
11  std::exception_ptr ex_ptr)
12 {
13  // A non-null exception pointer is always registered with the task
14  // even if the task's 'done' count will not yet decrement to zero.
15  // This ensures that once the task's 'done' count is zero, an
16  // exception will be registered with the task when it is launched.
17  if (ex_ptr) {
18  task->dependentTaskFailed(ex_ptr);
19  }
20  if (task->decrement_done_count() == 0u) {
21  group_.run([t = std::move(task)] { (*t)(); });
22  }
23 }
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={})