Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove static qualifier #1433

Merged
merged 3 commits into from
Nov 14, 2013
Merged

remove static qualifier #1433

merged 3 commits into from
Nov 14, 2013

Conversation

gartung
Copy link
Member

@gartung gartung commented Nov 12, 2013

No description provided.

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_7_0_X.

remove static qualifier

It involves the following packages:

RecoTracker/MeasurementDet

@nclopezo, @cmsbuild, @thspeer, @slava77 can you please review it and eventually sign? Thanks.
@ghellwig, @gpetruc, @GiacomoSguazzoni, @rovere, @cerati this is something you requested to watch as well.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
@ktf you are the release manager for this.

std::vector<uint32_t> rawInactiveDetIds;
if (!theInactivePixelDetectorLabels.empty()) {
edm::Handle<DetIdCollection> detIds;
bool iFailedAlready =false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time this routine is called, it may print the LogError. That wasn't the intent of the code. I'd instead make this a

static std::atomic<bool> iFailedAlready{ false };

@cmsbuild
Copy link
Contributor

Pull request #1433 was updated. @nclopezo, @cmsbuild, @thspeer, @slava77 can you please check and sign again.

@@ -67,7 +66,7 @@
if (event.getByLabel(*itt, detIds)){
rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
}else{
static bool iFailedAlready=false;
static std::atomic<bool> iFailedAlread{false};
if (!iFailedAlready){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you want to do

bool expected = false;
if(iFailedAlready.compare_exchange_strong(expected,true,std::memory_order_acq_rel) ) {

and then get rid of the iFailedAlready=true. That code change will guarantee that the printout will happen once and only once.

@cmsbuild
Copy link
Contributor

Pull request #1433 was updated. @nclopezo, @cmsbuild, @thspeer, @slava77 can you please check and sign again.

@cmsbuild
Copy link
Contributor

@thspeer
Copy link
Contributor

thspeer commented Nov 14, 2013

+1
Tested d0e380a in CMSSW_7_0_X_2013-11-13-0200-1433
No difference in reco as expected, based on RelMon and reco script

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. @ktf can you please take care of it?

ktf added a commit that referenced this pull request Nov 14, 2013
Multithreading fixes -- Make static atomic in RecoTracker/MeasurementDet
@ktf ktf merged commit 43b937e into cms-sw:CMSSW_7_0_X Nov 14, 2013
@gartung gartung deleted the statics-RecoTracker-MeasurementDet branch November 14, 2013 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants