Public Member Functions | Private Attributes | List of all members
cet::SimultaneousFunctionSpawner Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/cetlib/v3_06_01/source/cetlib/SimultaneousFunctionSpawner.h"

Public Member Functions

template<typename FunctionToSpawn >
 SimultaneousFunctionSpawner (std::vector< FunctionToSpawn > const &fs)
 

Private Attributes

std::atomic< std::size_t > counter_
 

Detailed Description

Definition at line 47 of file SimultaneousFunctionSpawner.h.

Constructor & Destructor Documentation

template<typename FunctionToSpawn >
cet::SimultaneousFunctionSpawner::SimultaneousFunctionSpawner ( std::vector< FunctionToSpawn > const &  fs)
inline

Definition at line 50 of file SimultaneousFunctionSpawner.h.

References counter_, g4zmq::execute(), MakeMiniprodValidationCuts::f, nd_projection_maker::fs, and generate_CCQE_events::threads.

51  : counter_{fs.size()}
52  {
53  auto execute = [this](auto f) {
54  --counter_;
55  while (counter_ != 0)
56  ;
57  f();
58  };
59 
60  std::vector<std::thread> threads;
61  for (auto f : fs) {
62  threads.emplace_back(execute, f);
63  }
64 
65  for (auto& thread : threads)
66  thread.join();
67  }
def execute(command)
Definition: g4zmq.py:44

Member Data Documentation

std::atomic<std::size_t> cet::SimultaneousFunctionSpawner::counter_
private

Definition at line 70 of file SimultaneousFunctionSpawner.h.

Referenced by SimultaneousFunctionSpawner().


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