Skip to content

Commit

Permalink
Merge pull request #37390 from Dr15Jones/JobReportThreadSafety_12_2
Browse files Browse the repository at this point in the history
Make JobReport::reportReadBranches thread safe [12_2]
  • Loading branch information
cmsbuild committed Mar 29, 2022
2 parents cd33eab + 4e35aa7 commit 998c6af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FWCore/MessageLogger/interface/JobReport.h
Expand Up @@ -255,7 +255,7 @@ namespace edm {
std::map<std::string, long long> readBranches_;
std::map<std::string, long long> readBranchesSecFile_;
tbb::concurrent_unordered_map<std::string, AtomicLongLong> readBranchesSecSource_;
bool printedReadBranches_;
std::atomic<bool> printedReadBranches_;
std::vector<InputFile>::size_type lastOpenedPrimaryInputFile_;
edm::propagate_const<std::ostream*> ost_;
};
Expand Down
4 changes: 2 additions & 2 deletions FWCore/MessageLogger/src/JobReport.cc
Expand Up @@ -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 << "<ReadBranches>\n";
Expand Down

0 comments on commit 998c6af

Please sign in to comment.