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

Switch to std::mutex in ThreadSafeRegistry #4765

Merged

Conversation

Dr15Jones
Copy link
Contributor

edm::ThreadSafeRegistry was formerly using boost::mutex but we prefer std::mutex.
Moved the shared global std::mutex so its storage is declared in FWCore/Utilities instead of in all files which were including ThreadSafeRegistry.icc.
Removed unnecessary includes of ThreadSafeRegistry.h from the framework internals.

The ThreadLocalRegistry was previously using a boost::mutex but we now prefer std::mutex.
In addition, since all templated instances of ThreadLocalRegistry use the same global mutex,
the storage for that mutex was moved to its own .cc file rather than having each use of the .icc
file create new storage.
@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones (Chris Jones) for CMSSW_7_2_X.

Switch to std::mutex in ThreadSafeRegistry

It involves the following packages:

DataFormats/FWLite
FWCore/Common
FWCore/Framework
FWCore/Utilities
IOPool/Streamer

@cmsbuild, @Degano, @Dr15Jones, @ktf, @nclopezo can you please review it and eventually sign? Thanks.
@wddgit, @wmtan 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.

@Dr15Jones
Copy link
Contributor Author

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes or unless it breaks tests.

@cmsbuild
Copy link
Contributor

-1
Tested at: 8fcc292
I found an error when building:

>> Compiling  /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/HLTrigger/HLTcore/src/HLTConfigData.cc 
>> Compiling  /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/HLTrigger/HLTcore/src/HLTConfigDataRegistry.cc 
>> Compiling  /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/HLTrigger/HLTcore/src/HLTConfigProvider.cc 
In file included from /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/HLTrigger/HLTcore/interface/HLTConfigDataRegistry.h:7:0,
                 from /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/HLTrigger/HLTcore/src/HLTConfigDataRegistry.cc:2:
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc:9:51: error: conflicting specifiers in declaration of 'registry_mutex'
     [[edm::thread_safe]] extern static std::mutex registry_mutex;
                                                   ^
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc: In member function 'bool edm::detail::ThreadSafeRegistry::getMapped(const key_type&, edm::detail::ThreadSafeRegistry::value_type&) const':
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-23-0200/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc:27:25: error: missing template arguments before 'lock'
         std::lock_guard lock(registry_mutex);


you can see the results of the tests here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-4765/443/summary.html

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes (but tests are reportedly failing).

@cmsbuild
Copy link
Contributor

-1
Tested at: 8fcc292
I found an error when building:

>> Compiling  /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/HLTrigger/HLTcore/src/HLTConfigDataRegistry.cc 
Leaving library rule at Geometry/CommonTopologies
>> Compiling  /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/HLTrigger/HLTcore/src/HLTConfigProvider.cc 
In file included from /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/HLTrigger/HLTcore/interface/HLTConfigDataRegistry.h:7:0,
                 from /build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/HLTrigger/HLTcore/src/HLTConfigDataRegistry.cc:2:
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc:9:51: error: conflicting specifiers in declaration of 'registry_mutex'
     [[edm::thread_safe]] extern static std::mutex registry_mutex;
                                                   ^
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc: In member function 'bool edm::detail::ThreadSafeRegistry::getMapped(const key_type&, edm::detail::ThreadSafeRegistry::value_type&) const':
/build/cmsbuild/jenkins-workarea/workspace/ib-integration-CMSSW_7_2_X-slc6_amd64_gcc481/CMSSW_7_2_X_2014-07-22-1400/src/FWCore/Utilities/interface/ThreadSafeRegistry.icc:27:25: error: missing template arguments before 'lock'
         std::lock_guard lock(registry_mutex);


you can see the results of the tests here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-4765/451/summary.html

-Removed all the interfaces which provided direct internal access
 to the container and therefore were not thread-safe
-Protected all remaining interfaces with the mutex
-Made the mutex a member variable to avoid creating one each time
 the .icc file is included.
@cmsbuild
Copy link
Contributor

Pull request #4765 was updated. @cmsbuild, @Degano, @Dr15Jones, @ktf, @nclopezo can you please check and sign again.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@Dr15Jones
Copy link
Contributor Author

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes (tests are also fine).

nclopezo added a commit that referenced this pull request Jul 25, 2014
…egistry

Switch to std::mutex in ThreadSafeRegistry
@nclopezo nclopezo merged commit 6068a45 into cms-sw:CMSSW_7_2_X Jul 25, 2014
@cmsbuild
Copy link
Contributor

@Dr15Jones Dr15Jones deleted the switchToStdMutexInThreadSafeRegistry branch August 27, 2014 18:20
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.

None yet

3 participants