From e27bac50e0d8e9e8ee246cbbc310e265541674e7 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 27 Jun 2014 17:31:56 +0200 Subject: [PATCH] Marked statics as thread-safe since update only at library load The singletons VertexRecoManager and VertexFitterManager are only updated while the library in which they are embedded is loaded. Therefore access to these singletons is thread-safe. By marking them with our C++11 attribute, the static analyzer will no longer complain about them. --- RecoVertex/ConfigurableVertexReco/src/VertexFitterManager.cc | 5 ++++- RecoVertex/ConfigurableVertexReco/src/VertexRecoManager.cc | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RecoVertex/ConfigurableVertexReco/src/VertexFitterManager.cc b/RecoVertex/ConfigurableVertexReco/src/VertexFitterManager.cc index 5d12f1cdc4190..724cd0a75256d 100644 --- a/RecoVertex/ConfigurableVertexReco/src/VertexFitterManager.cc +++ b/RecoVertex/ConfigurableVertexReco/src/VertexFitterManager.cc @@ -53,7 +53,10 @@ VertexFitterManager::VertexFitterManager ( const VertexFitterManager & o ) VertexFitterManager & VertexFitterManager::Instance() { - static VertexFitterManager singleton; + //The singleton's internal structure only changes while + // this library is being loaded. All other methods are const. + + [[cms::thread_safe]] static VertexFitterManager singleton; return singleton; } diff --git a/RecoVertex/ConfigurableVertexReco/src/VertexRecoManager.cc b/RecoVertex/ConfigurableVertexReco/src/VertexRecoManager.cc index c7efff397317b..cd139948baed7 100644 --- a/RecoVertex/ConfigurableVertexReco/src/VertexRecoManager.cc +++ b/RecoVertex/ConfigurableVertexReco/src/VertexRecoManager.cc @@ -44,7 +44,9 @@ VertexRecoManager::VertexRecoManager ( const VertexRecoManager & o ) VertexRecoManager & VertexRecoManager::Instance() { - static VertexRecoManager singleton; + //The singleton's internal structure only changes while + // this library is being loaded. All other methods are const. + [[cms::thread_safe]] static VertexRecoManager singleton; return singleton; }