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
Thread safe changes for Geometry CommonDetUnit #1322
Thread safe changes for Geometry CommonDetUnit #1322
Conversation
@Dr15Jones please review |
A new Pull Request was created by @vkuznet (Valentin Kuznetsov) for CMSSW_7_0_X. Thread safe changes for Geometry CommonDetUnit It involves the following packages: Geometry/CommonDetUnit @civanch, @Dr15Jones, @ianna, @mdhildreth, @nclopezo, @ktf can you please review it and eventually sign? Thanks. |
} | ||
return theDetTypes; | ||
if (!theDetTypes.load(std::memory_order_acquire)) { | ||
auto ptr = new DetTypeContainer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to always use a std::unique_ptr<> to manage the memory.
Pull request #1322 was updated. @civanch, @Dr15Jones, @ianna, @mdhildreth, @cmsbuild, @nclopezo, @ktf can you please check and sign again. |
} | ||
DetTypeContainer* expect = nullptr; | ||
bool exchanged = theDetTypes.compare_exchange_strong(expect, ptr.get(), std::memory_order_acq_rel); | ||
if(!exchanged) ptr.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always delete the object held by the auto_ptr<>. The necessary pattern is
if(theDetTypes.compare_exchange_strong(...) ) {
//releases ownership
ptr.release();
}
-1 |
Pull request #1322 was updated. @civanch, @Dr15Jones, @ianna, @mdhildreth, @cmsbuild, @nclopezo, @ktf can you please check and sign again. |
Looks good to me |
-1 ---> test runtestPhysicsToolsPatAlgos had ERRORS you can see the results of the tests here: |
Pull request #1322 was updated. @civanch, @Dr15Jones, @ianna, @mdhildreth, @cmsbuild, @nclopezo, @ktf can you please check and sign again. |
+1 |
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? |
Multithreading fixes -- Thread safe changes for Geometry CommonDetUnit
No description provided.