diff --git a/FWCore/MessageLogger/interface/JobReport.h b/FWCore/MessageLogger/interface/JobReport.h index aa0ab8308429a..2effaf489f5e6 100644 --- a/FWCore/MessageLogger/interface/JobReport.h +++ b/FWCore/MessageLogger/interface/JobReport.h @@ -255,7 +255,7 @@ namespace edm { std::map readBranches_; std::map readBranchesSecFile_; tbb::concurrent_unordered_map readBranchesSecSource_; - bool printedReadBranches_; + std::atomic printedReadBranches_; std::vector::size_type lastOpenedPrimaryInputFile_; edm::propagate_const ost_; }; diff --git a/FWCore/MessageLogger/src/JobReport.cc b/FWCore/MessageLogger/src/JobReport.cc index 78e5537d22303..bfdcdeada0a9d 100644 --- a/FWCore/MessageLogger/src/JobReport.cc +++ b/FWCore/MessageLogger/src/JobReport.cc @@ -567,9 +567,9 @@ namespace edm { } void JobReport::reportReadBranches() { - if (impl_->printedReadBranches_) + bool expected = false; + if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true)) return; - impl_->printedReadBranches_ = true; if (impl_->ost_) { std::ostream& ost = *(impl_->ost_); ost << "\n";