Skip to content

Commit

Permalink
Merge pull request #38037 from Dr15Jones/moreLocksJobReport_12_4
Browse files Browse the repository at this point in the history
Lock more methods of JobReport [12_4]
  • Loading branch information
cmsbuild authored May 23, 2022
2 parents b60f2fa + f681b22 commit 0e65cbe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions FWCore/MessageLogger/src/JobReport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,11 @@ namespace edm {
void JobReport::inputFileClosed(InputType inputType, JobReport::Token fileToken) {
JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
f.fileHasBeenClosed = true;
std::lock_guard<std::mutex> lock(write_mutex);
if (inputType == InputType::Primary) {
impl_->writeInputFile(f);
} else {
{
std::lock_guard<std::mutex> lock(write_mutex);
impl_->writeInputFile(f);
}
impl_->writeInputFile(f);
}
}

Expand Down Expand Up @@ -434,6 +432,7 @@ namespace edm {
void JobReport::outputFileClosed(JobReport::Token fileToken) {
JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
f.fileHasBeenClosed = true;
std::lock_guard<std::mutex> lock(write_mutex);
impl_->writeOutputFile(f);
}

Expand Down Expand Up @@ -541,6 +540,7 @@ namespace edm {

void JobReport::reportMemoryInfo(std::vector<std::string> const& memoryData) {
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& msg = *(impl_->ost_);
msg << "<MemoryService>\n";

Expand All @@ -555,6 +555,7 @@ namespace edm {

void JobReport::reportMessageInfo(std::map<std::string, double> const& messageData) {
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& msg = *(impl_->ost_);
msg << "<MessageSummary>\n";
typedef std::map<std::string, double>::const_iterator const_iterator;
Expand All @@ -572,6 +573,7 @@ namespace edm {
if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true))
return;
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& ost = *(impl_->ost_);
ost << "<ReadBranches>\n";
tinyxml2::XMLDocument doc;
Expand Down

0 comments on commit 0e65cbe

Please sign in to comment.