From bd0ec714311e93b03708ae765cd24b49f40b94fc Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Wed, 6 Feb 2019 12:17:48 +0100 Subject: [PATCH] Enable thread safety checker and small fixes Enable the thread safety checker for some of the MT-related trigger packages and fix a few small warnings found by it. --- .../ATLAS_CHECK_THREAD_SAFETY | 1 + .../DecisionHandling/HLTIdentifier.h | 8 +++---- .../src/TrigCompositeUtils.cxx | 6 ++--- .../test/TrigCompositeUtils_test.cxx | 3 ++- .../L1Decoder/ATLAS_CHECK_THREAD_SAFETY | 1 + .../ATLAS_CHECK_THREAD_SAFETY | 1 + .../HLTResultByteStreamTool.h | 5 ++-- .../src/HLTResultByteStreamTool.cxx | 23 ++++++++----------- .../ViewAlgs/ATLAS_CHECK_THREAD_SAFETY | 1 + .../ViewAlgsTest/ATLAS_CHECK_THREAD_SAFETY | 1 + 10 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 Trigger/TrigSteer/DecisionHandling/DecisionHandling/ATLAS_CHECK_THREAD_SAFETY create mode 100644 Trigger/TrigSteer/L1Decoder/L1Decoder/ATLAS_CHECK_THREAD_SAFETY create mode 100644 Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/ATLAS_CHECK_THREAD_SAFETY create mode 100644 Trigger/TrigSteer/ViewAlgs/ViewAlgs/ATLAS_CHECK_THREAD_SAFETY create mode 100644 Trigger/TrigSteer/ViewAlgsTest/ATLAS_CHECK_THREAD_SAFETY diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..6b9e5011e85a --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigSteer/DecisionHandling diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h index 17b0e0f5d776..ec0fa212a202 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/HLTIdentifier.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef DecisionHandling_HLTIdentifier_h @@ -10,9 +10,9 @@ #include <set> #include <map> - - #include "GaudiKernel/MsgStream.h" +#include "CxxUtils/checker_macros.h" + /** * @brief An trigger identifier class, used to provide mapping fromt the human readable IDs to efficienct unsigned ints **/ @@ -54,7 +54,7 @@ public: bool operator < ( unsigned id ) const { return numeric() < id; } private: unsigned m_id; - static bool s_reportStringIDs; + static bool s_reportStringIDs ATLAS_THREAD_SAFE; }; typedef std::vector<HLT::Identifier> IDVec; diff --git a/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx b/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx index cfffdd294b14..581958e813a9 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/TrigCompositeUtils.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "StoreGate/WriteHandle.h" #include "StoreGate/ReadHandle.h" @@ -12,8 +12,8 @@ -static SG::AuxElement::Accessor< std::vector< int > > readWriteAccessor( "decisions" ); -static SG::AuxElement::ConstAccessor< std::vector<int> > readOnlyAccessor( "decisions" ); +static const SG::AuxElement::Accessor< std::vector< int > > readWriteAccessor( "decisions" ); +static const SG::AuxElement::ConstAccessor< std::vector<int> > readOnlyAccessor( "decisions" ); namespace TrigCompositeUtils { diff --git a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx index 4b1752f534ed..48940d6b3369 100644 --- a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx +++ b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx @@ -14,10 +14,11 @@ #include "DecisionHandling/TrigCompositeUtils.h" #include "xAODTrigger/TrigCompositeAuxContainer.h" +bool xAOD::TrigComposite::s_throwOnCopyError = true; + int main() { using namespace TrigCompositeUtils; - xAOD::TrigComposite::s_throwOnCopyError = true; errorcheck::ReportMessage::hideFunctionNames (true); diff --git a/Trigger/TrigSteer/L1Decoder/L1Decoder/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigSteer/L1Decoder/L1Decoder/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..15afe1471763 --- /dev/null +++ b/Trigger/TrigSteer/L1Decoder/L1Decoder/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigSteer/L1Decoder diff --git a/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..b0a752adf71f --- /dev/null +++ b/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigSteer/TrigHLTResultByteStream diff --git a/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/HLTResultByteStreamTool.h b/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/HLTResultByteStreamTool.h index bcd3c2da3d07..460255c7a8fc 100755 --- a/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/HLTResultByteStreamTool.h +++ b/Trigger/TrigSteer/TrigHLTResultByteStream/TrigHLTResultByteStream/HLTResultByteStreamTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -77,8 +77,7 @@ namespace HLT { FullEventAssembler<HLTSrcIdMap>* eventAssembler(std::string objName); //!< helper method private: - static std::string s_l2ResultName, s_efResultName, s_hltResultName, s_dataScoutingResultName; //!< LVL2 and EF StoreGate keys - static eformat::SubDetector s_idL2, s_idEF; //!< eformat TDAQ "subdetector" + static const std::string s_l2ResultName, s_efResultName, s_hltResultName, s_dataScoutingResultName; //!< LVL2 and EF StoreGate keys FullEventAssembler<HLTSrcIdMap> m_feaL2, m_feaEF; //!< helper for reading }; diff --git a/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultByteStreamTool.cxx b/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultByteStreamTool.cxx index a825e8a357c3..4387d217c545 100755 --- a/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultByteStreamTool.cxx +++ b/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultByteStreamTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -10,13 +10,10 @@ #include <iostream> #include <stdlib.h> -std::string HLT::HLTResultByteStreamTool::s_l2ResultName = "HLTResult_L2"; -std::string HLT::HLTResultByteStreamTool::s_efResultName = "HLTResult_EF"; -std::string HLT::HLTResultByteStreamTool::s_hltResultName = "HLTResult_HLT"; -std::string HLT::HLTResultByteStreamTool::s_dataScoutingResultName = "DataScouting_"; - -eformat::SubDetector HLT::HLTResultByteStreamTool::s_idL2 = eformat::TDAQ_LVL2; -eformat::SubDetector HLT::HLTResultByteStreamTool::s_idEF = eformat::TDAQ_EVENT_FILTER; // same as TDAQ_HLT in eformat5 +const std::string HLT::HLTResultByteStreamTool::s_l2ResultName = "HLTResult_L2"; +const std::string HLT::HLTResultByteStreamTool::s_efResultName = "HLTResult_EF"; +const std::string HLT::HLTResultByteStreamTool::s_hltResultName = "HLTResult_HLT"; +const std::string HLT::HLTResultByteStreamTool::s_dataScoutingResultName = "DataScouting_"; HLT::HLTResultByteStreamTool::HLTResultByteStreamTool( const std::string& type, const std::string& name, @@ -24,8 +21,8 @@ HLT::HLTResultByteStreamTool::HLTResultByteStreamTool( const std::string& type, : AthAlgTool(type,name,parent) { declareInterface< HLT::HLTResultByteStreamTool >( this ); - m_feaL2.idMap().setDetId(s_idL2); - m_feaEF.idMap().setDetId(s_idEF); + m_feaL2.idMap().setDetId(eformat::TDAQ_LVL2); + m_feaEF.idMap().setDetId(eformat::TDAQ_EVENT_FILTER); } @@ -35,9 +32,9 @@ HLT::HLTResultByteStreamTool::~HLTResultByteStreamTool() eformat::SubDetector HLT::HLTResultByteStreamTool::byteStreamLocation(std::string objName) { - if (objName == s_l2ResultName) return s_idL2; - if (objName == s_efResultName || objName == s_hltResultName) return s_idEF; - if (objName.substr(0,s_dataScoutingResultName.length()) == s_dataScoutingResultName) return s_idEF; + if (objName == s_l2ResultName) return eformat::TDAQ_LVL2; + if (objName == s_efResultName || objName == s_hltResultName) return eformat::TDAQ_EVENT_FILTER; + if (objName.substr(0,s_dataScoutingResultName.length()) == s_dataScoutingResultName) return eformat::TDAQ_EVENT_FILTER; return eformat::OTHER; } diff --git a/Trigger/TrigSteer/ViewAlgs/ViewAlgs/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigSteer/ViewAlgs/ViewAlgs/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..faf075e6e1e8 --- /dev/null +++ b/Trigger/TrigSteer/ViewAlgs/ViewAlgs/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigSteer/ViewAlgs diff --git a/Trigger/TrigSteer/ViewAlgsTest/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigSteer/ViewAlgsTest/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..547ac74b630f --- /dev/null +++ b/Trigger/TrigSteer/ViewAlgsTest/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigSteer/ViewAlgsTest -- GitLab