LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::GlobalTaskGroup Class Reference

#include "GlobalTaskGroup.h"

Public Member Functions

 GlobalTaskGroup (unsigned n_threads, unsigned stack_size)
 
template<typename T >
void run (T &&t)
 
void may_run (hep::concurrency::WaitingTaskPtr task, std::exception_ptr ex_ptr={})
 
tbb::task_group & native_group ()
 

Private Attributes

tbb::global_control threadControl_
 
tbb::global_control stackSizeControl_
 
tbb::task_group group_
 

Detailed Description

Definition at line 11 of file GlobalTaskGroup.h.

Constructor & Destructor Documentation

art::GlobalTaskGroup::GlobalTaskGroup ( unsigned  n_threads,
unsigned  stack_size 
)

Definition at line 3 of file GlobalTaskGroup.cc.

References stackSizeControl_.

5  : threadControl_{tbb::global_control::max_allowed_parallelism, n_threads}
6  , stackSizeControl_{tbb::global_control::thread_stack_size, stack_size}
7 {}
tbb::global_control threadControl_
tbb::global_control stackSizeControl_

Member Function Documentation

void art::GlobalTaskGroup::may_run ( hep::concurrency::WaitingTaskPtr  task,
std::exception_ptr  ex_ptr = {} 
)

Definition at line 10 of file GlobalTaskGroup.cc.

References group_.

Referenced by art::WorkerInPath::WorkerInPathDoneTask::operator()(), art::TriggerPathsExecutor::PathsDoneTask::operator()(), art::EndPathExecutor::PathsDoneTask::operator()(), art::TriggerPathsExecutor::process_event(), art::EndPathExecutor::process_event(), and run().

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::task_group group_
tbb::task_group& art::GlobalTaskGroup::native_group ( )
inline

Definition at line 27 of file GlobalTaskGroup.h.

References group_.

Referenced by art::PathManager::createModulesAndWorkers(), and art::PathManager::fillWorkers_().

28  {
29  return group_;
30  }
tbb::task_group group_
template<typename T >
void art::GlobalTaskGroup::run ( T &&  t)
inline

Definition at line 17 of file GlobalTaskGroup.h.

References group_, and may_run().

18  {
19  group_.run(std::move(t));
20  }
tbb::task_group group_

Member Data Documentation

tbb::task_group art::GlobalTaskGroup::group_
private

Definition at line 35 of file GlobalTaskGroup.h.

Referenced by may_run(), native_group(), and run().

tbb::global_control art::GlobalTaskGroup::stackSizeControl_
private

Definition at line 34 of file GlobalTaskGroup.h.

Referenced by GlobalTaskGroup().

tbb::global_control art::GlobalTaskGroup::threadControl_
private

Definition at line 33 of file GlobalTaskGroup.h.


The documentation for this class was generated from the following files: