18 const UInt_t poolSize = 4U;
20 Int_t mt201_parallelHistoFill()
29 auto fillRandomHisto = [&](
int seed = 0) {
37 auto histogram = ts_h.Get();
39 histogram->Fill(rndm.Gaus(0, 1));
46 std::vector<std::thread> pool;
52 auto monitor = [&]() {
54 std::this_thread::sleep_for(std::chrono::duration<double, std::nano>(500));
55 auto h = ts_h.SnapshotMerge();
56 std::cout <<
"Entries for the snapshot " <<
h->
GetEntries() << std::endl;
59 pool.emplace_back(monitor);
63 pool.emplace_back(fillRandomHisto, seed);
67 for (
auto && t : pool) t.join();
70 auto sumRandomHisto = ts_h.Merge();
72 std::cout <<
"Entries for the total sum " << sumRandomHisto->GetEntries() << std::endl;
75 sumRandomHisto->DrawClone();
Random number generator class based on M.
A wrapper to make object instances thread private, lazily.
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
A pseudo container class which is a generator of indices.
virtual Double_t GetEntries() const
Return the current number of entries.