From 0480090c974db01dd5167ae5fbebaa7197fe7280 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 4 Nov 2019 16:27:52 +0000 Subject: [PATCH] Add ATLAS_CHECK_THREAD_SAFETY, mark some run-I EDM classes/methods as unsafe --- .../CaloEvent/ATLAS_CHECK_THREAD_SAFETY | 1 + .../CaloEvent/CaloEvent/CaloBinDescriptor.h | 4 ++-- Calorimeter/CaloEvent/CaloEvent/CaloCluster.h | 13 +++++++------ .../CaloEvent/CaloEvent/CaloClusterContainer.h | 4 +++- .../CaloEvent/CaloEvent/CaloClusterNavigable.h | 8 ++++++-- .../CaloEvent/CaloConstCellContainer.h | 18 ++++++++++-------- .../CaloEvent/CaloConstCellContainer.icc | 2 +- .../CaloEvent/CaloEvent/CaloSamplingHelper.h | 12 ++++++------ Calorimeter/CaloEvent/CaloEvent/CaloTowerSeg.h | 2 +- Calorimeter/CaloEvent/src/CaloCluster.cxx | 2 +- .../CaloEvent/src/CaloSamplingHelper.cxx | 12 ++++++------ Calorimeter/CaloEvent/src/CaloTowerSeg.cxx | 4 ++-- .../test/CaloCellContainerTestCommon.icc | 3 +++ .../CaloEvent/test/CaloCellContainer_test.cxx | 2 ++ .../test/CaloCellPrefetchIterator_test.cxx | 2 ++ .../test/CaloConstCellContainer_test.cxx | 3 +++ 16 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 Calorimeter/CaloEvent/CaloEvent/ATLAS_CHECK_THREAD_SAFETY diff --git a/Calorimeter/CaloEvent/CaloEvent/ATLAS_CHECK_THREAD_SAFETY b/Calorimeter/CaloEvent/CaloEvent/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 00000000000..7815b311cd3 --- /dev/null +++ b/Calorimeter/CaloEvent/CaloEvent/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Calorimeter/CaloEvent diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloBinDescriptor.h b/Calorimeter/CaloEvent/CaloEvent/CaloBinDescriptor.h index 3d7d44c18e1..87c91cc64cf 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloBinDescriptor.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloBinDescriptor.h @@ -115,7 +115,7 @@ class CaloBinDescriptor std::vector m_bins; /*! \brief Out-of-range marker (convention) */ - static size_t m_outOfRange; + static const size_t m_outOfRange; }; template @@ -134,7 +134,7 @@ CaloBinDescriptor::operator=(const CaloBinDescriptor& theBins) } template -size_t CaloBinDescriptor::m_outOfRange = size_t(-1); +const size_t CaloBinDescriptor::m_outOfRange = size_t(-1); template CaloBinDescriptor::CaloBinDescriptor(const std::vector& theBins) diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h b/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h index f984a5fd428..2ef118499b2 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h @@ -61,6 +61,7 @@ Update: Sep 18, 2005 P Loch #include #include "GeoPrimitives/GeoPrimitives.h" +#include "CxxUtils/checker_macros.h" class CaloCell ; @@ -70,11 +71,11 @@ class CaloCluster; struct CaloClusterSignalState; -class CaloCluster : public CaloCompositeKineBase, - public CaloCompositeCellBase, - virtual public INavigable4Momentum, - public ISignalState, - public AthenaBarCodeBase +class ATLAS_NOT_THREAD_SAFE CaloCluster : public CaloCompositeKineBase, + public CaloCompositeCellBase, + virtual public INavigable4Momentum, + public ISignalState, + public AthenaBarCodeBase { public: @@ -463,7 +464,7 @@ class CaloCluster : public CaloCompositeKineBase, CaloClusterLinkTemplate::link_type data_link_type; /*! \brief Internal error return for real numbers */ - static double m_errorValue; + static const double m_errorValue; /*!{\ brief Cached Stores */ CaloSamplingData m_dataStore; /*!< sampling data */ diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloClusterContainer.h b/Calorimeter/CaloEvent/CaloEvent/CaloClusterContainer.h index 7d6b74a7adc..8d4b634accf 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloClusterContainer.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloClusterContainer.h @@ -28,6 +28,8 @@ PURPOSE: Container for CaloCluster objects #include "CaloEvent/CaloTowerSeg.h" #include "CaloEvent/CaloCluster.h" #include "NavFourMom/INavigable4MomentumCollection.h" +#include "CxxUtils/checker_macros.h" + DATAVECTOR_VIRTBASES1 (CaloCluster, INavigable4Momentum); @@ -75,7 +77,7 @@ class CaloClusterContainer : public DataVector void print(); /** reimplementation of push_back */ - void push_back(const CaloCluster *); + void push_back ATLAS_NOT_THREAD_SAFE(const CaloCluster *); void push_back(CaloCluster *); private: diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloClusterNavigable.h b/Calorimeter/CaloEvent/CaloEvent/CaloClusterNavigable.h index 8e1281d7a69..e0c2cadcf17 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloClusterNavigable.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloClusterNavigable.h @@ -26,6 +26,10 @@ #include +#include "GeoPrimitives/GeoPrimitives.h" +#include "CxxUtils/checker_macros.h" + + class CaloClusterNavigable : virtual public INavigable { public: @@ -137,7 +141,7 @@ class CaloClusterNavigable : virtual public INavigable const boost::any& rPar) const; /** \brief replace container for all cells*/ - virtual bool replaceCellContainer(const CaloCellContainer* newCont) const; + virtual bool replaceCellContainer ATLAS_NOT_CONST_THREAD_SAFE(const CaloCellContainer* newCont) const; virtual bool isCellLinkValid() const ; @@ -164,7 +168,7 @@ protected: friend class CaloClusterContainerCnv_p7; friend class CaloClusterContainerCnvTestMakeCluster; - CaloCellLink* getCellLink(); + CaloCellLink* getCellLink ATLAS_NOT_CONST_THREAD_SAFE(); const CaloCellLink* getCellLink() const; bool setCellLink(CaloCellLinkContainer* pLink); diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.h b/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.h index e268e806f31..541d0734616 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.h @@ -20,6 +20,8 @@ #include "CaloEvent/CaloCellContainer.h" #include "AthContainers/ConstDataVector.h" +#include "CxxUtils/checker_macros.h" + /** * @brief @c CaloCellContainer that can accept const cell pointers. @@ -65,7 +67,7 @@ public: /** @brief indicate that the container is complete and in order */ - void setIsOrderedAndComplete(bool ordered); + void setIsOrderedAndComplete ATLAS_NOT_CONST_THREAD_SAFE (bool ordered); /** @brief tell wether container is complete and in order */ @@ -77,7 +79,7 @@ public: /** @brief indicates that the container is ordered */ - void setIsOrdered(bool ordered); + void setIsOrdered ATLAS_NOT_CONST_THREAD_SAFE (bool ordered); /** @brief tell wether container is ordered */ @@ -107,7 +109,7 @@ public: /** @brief set which calo has been filled. */ - void setHasCalo(CaloCell_ID::SUBCALO caloNum); + void setHasCalo ATLAS_NOT_CONST_THREAD_SAFE (CaloCell_ID::SUBCALO caloNum); /** @brief fill calo iterators and the index of first and last cell @@ -147,15 +149,15 @@ public: /** @brief order container */ - void order(); + void order ATLAS_NOT_CONST_THREAD_SAFE (); /** @brief reimplementation of push_back to gain speed in readin */ - void push_back_fast (const CaloCell* cell); + void push_back_fast ATLAS_NOT_THREAD_SAFE(const CaloCell* cell); /** @brief reset look up table */ - void resetLookUpTable(); + void resetLookUpTable ATLAS_NOT_CONST_THREAD_SAFE(); private: @@ -164,10 +166,10 @@ private: /** @brief If @ flag is true, then the container size equals the maximum hash. * Only CaloCellContainerFinalizer tool is allowed to set this. */ - void setHasTotalSize(bool flag); + void setHasTotalSize ATLAS_NOT_CONST_THREAD_SAFE (bool flag); /// Return a non-const pointer to the base container. - ::CaloCellContainer* baseContainer(); + ::CaloCellContainer* baseContainer ATLAS_NOT_CONST_THREAD_SAFE (); }; diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.icc b/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.icc index 2c34139b556..1be92f170ad 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.icc +++ b/Calorimeter/CaloEvent/CaloEvent/CaloConstCellContainer.icc @@ -199,7 +199,7 @@ CaloConstCellContainer::findCellVector (const std::vector & theV /** @brief order container */ inline -void CaloConstCellContainer::order() +void CaloConstCellContainer::order () { baseContainer()->order(); } diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloSamplingHelper.h b/Calorimeter/CaloEvent/CaloEvent/CaloSamplingHelper.h index 878ae3cfe39..2d0e730dfbf 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloSamplingHelper.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloSamplingHelper.h @@ -75,12 +75,12 @@ private: CaloSamplingHelper( const CaloSamplingHelper& rhs); CaloSamplingHelper& operator =( const CaloSamplingHelper& rhs); - static unsigned int m_EMMask; - static unsigned int m_HADMask; - static unsigned int m_BarrelMask; - static unsigned int m_EndCapMask; - static unsigned int m_LArMask; - static unsigned int m_TileMask; + static const unsigned int m_EMMask; + static const unsigned int m_HADMask; + static const unsigned int m_BarrelMask; + static const unsigned int m_EndCapMask; + static const unsigned int m_LArMask; + static const unsigned int m_TileMask; static bool matchPattern(const CaloSample& rSample, const unsigned int& mask); diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloTowerSeg.h b/Calorimeter/CaloEvent/CaloEvent/CaloTowerSeg.h index 5bf0ccad00b..6fbb1efc7ba 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloTowerSeg.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloTowerSeg.h @@ -414,7 +414,7 @@ class CaloTowerSeg // Can get rid of this when we move to the new CaloDetDescr // in which all CaloPhiRange methods are static. - static CaloPhiRange s_range; + static const CaloPhiRange s_range; }; // ---------------------------------------- diff --git a/Calorimeter/CaloEvent/src/CaloCluster.cxx b/Calorimeter/CaloEvent/src/CaloCluster.cxx index 4824fb5a91b..61fd30fe349 100644 --- a/Calorimeter/CaloEvent/src/CaloCluster.cxx +++ b/Calorimeter/CaloEvent/src/CaloCluster.cxx @@ -59,7 +59,7 @@ Updated: 30 Jun, 2005 S.Menke #include //#include -double CaloCluster::m_errorValue = -999.; +const double CaloCluster::m_errorValue = -999.; ///////////////// // Constructor // diff --git a/Calorimeter/CaloEvent/src/CaloSamplingHelper.cxx b/Calorimeter/CaloEvent/src/CaloSamplingHelper.cxx index 47504794deb..49633f27b06 100644 --- a/Calorimeter/CaloEvent/src/CaloSamplingHelper.cxx +++ b/Calorimeter/CaloEvent/src/CaloSamplingHelper.cxx @@ -27,12 +27,12 @@ #include "Identifier/Identifier.h" #include "CaloIdentifier/CaloID.h" -unsigned int CaloSamplingHelper::m_EMMask = 0x000000ff; -unsigned int CaloSamplingHelper::m_HADMask = 0x00ffff00; -unsigned int CaloSamplingHelper::m_BarrelMask = 0x001ff00f; -unsigned int CaloSamplingHelper::m_EndCapMask = 0x00e00ff0; -unsigned int CaloSamplingHelper::m_LArMask = 0x00e00fff; -unsigned int CaloSamplingHelper::m_TileMask = 0x001ff000; +const unsigned int CaloSamplingHelper::m_EMMask = 0x000000ff; +const unsigned int CaloSamplingHelper::m_HADMask = 0x00ffff00; +const unsigned int CaloSamplingHelper::m_BarrelMask = 0x001ff00f; +const unsigned int CaloSamplingHelper::m_EndCapMask = 0x00e00ff0; +const unsigned int CaloSamplingHelper::m_LArMask = 0x00e00fff; +const unsigned int CaloSamplingHelper::m_TileMask = 0x001ff000; CaloSamplingHelper::CaloSamplingHelper() { } diff --git a/Calorimeter/CaloEvent/src/CaloTowerSeg.cxx b/Calorimeter/CaloEvent/src/CaloTowerSeg.cxx index b0661647fd0..9a82c2be4b3 100644 --- a/Calorimeter/CaloEvent/src/CaloTowerSeg.cxx +++ b/Calorimeter/CaloEvent/src/CaloTowerSeg.cxx @@ -13,7 +13,7 @@ #include "CaloEvent/CaloTowerSeg.h" -CaloPhiRange CaloTowerSeg::s_range; +const CaloPhiRange CaloTowerSeg::s_range; /** @@ -24,7 +24,7 @@ CaloTowerSeg::SubSeg CaloTowerSeg::subseg (double eta, double deta, double phi, double dphi) const { typedef SubSeg::index_t index_t; - static CaloPhiRange range; + static const CaloPhiRange range; index_t etamin = this->etaIndex (eta - deta + 0.001); if (etamin == CaloTowerSeg::outOfRange) diff --git a/Calorimeter/CaloEvent/test/CaloCellContainerTestCommon.icc b/Calorimeter/CaloEvent/test/CaloCellContainerTestCommon.icc index 312a684f5ea..43918d9373d 100644 --- a/Calorimeter/CaloEvent/test/CaloCellContainerTestCommon.icc +++ b/Calorimeter/CaloEvent/test/CaloCellContainerTestCommon.icc @@ -17,6 +17,9 @@ #include "TestTools/random.h" +#include "CxxUtils/checker_macros.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; + //using Athena_test::randi; Athena_test::URNG stlrand; diff --git a/Calorimeter/CaloEvent/test/CaloCellContainer_test.cxx b/Calorimeter/CaloEvent/test/CaloCellContainer_test.cxx index 4e31bd39ed8..fb2ea1b812a 100644 --- a/Calorimeter/CaloEvent/test/CaloCellContainer_test.cxx +++ b/Calorimeter/CaloEvent/test/CaloCellContainer_test.cxx @@ -27,6 +27,8 @@ typedef std::vector CellVector; typedef CaloCellContainer CellContainer; +#include "CxxUtils/checker_macros.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; #include "CaloCellContainerTestCommon.icc" diff --git a/Calorimeter/CaloEvent/test/CaloCellPrefetchIterator_test.cxx b/Calorimeter/CaloEvent/test/CaloCellPrefetchIterator_test.cxx index db331613b1a..802f3edb49b 100644 --- a/Calorimeter/CaloEvent/test/CaloCellPrefetchIterator_test.cxx +++ b/Calorimeter/CaloEvent/test/CaloCellPrefetchIterator_test.cxx @@ -31,6 +31,8 @@ #include #include +#include "CxxUtils/checker_macros.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; using Athena_test::randf; diff --git a/Calorimeter/CaloEvent/test/CaloConstCellContainer_test.cxx b/Calorimeter/CaloEvent/test/CaloConstCellContainer_test.cxx index e2729ce4b42..84ea521f5fc 100644 --- a/Calorimeter/CaloEvent/test/CaloConstCellContainer_test.cxx +++ b/Calorimeter/CaloEvent/test/CaloConstCellContainer_test.cxx @@ -28,6 +28,9 @@ typedef std::vector CellVector; typedef CaloConstCellContainer CellContainer; #define CONST_CONTAINER +#include "CxxUtils/checker_macros.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; + #include "CaloCellContainerTestCommon.icc" -- GitLab