@@ -71,10 +71,11 @@ L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(const edm::ParameterSet& ps) {
7171 m_ExtendedCands.reserve (20 );
7272
7373 // set configuration parameters
74- if (not m_config) {
74+ if (! std::atomic_load (& m_config)) { // Atomically load m_config
7575 auto temp = std::make_shared<L1MuGMTConfig>(ps);
76- std::shared_ptr<L1MuGMTConfig> empty;
77- std::atomic_compare_exchange_strong (&m_config, &empty, temp);
76+ std::shared_ptr<L1MuGMTConfig> empty = nullptr ; // Explicit nullptr for CAS
77+ std::atomic_compare_exchange_strong_explicit (
78+ &m_config, &empty, temp, std::memory_order_acq_rel, std::memory_order_acquire);
7879 }
7980 m_writeLUTsAndRegs = ps.getUntrackedParameter <bool >(" WriteLUTsAndRegs" , false );
8081
@@ -122,10 +123,11 @@ L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(const edm::ParameterSet& ps) {
122123 edm::LogVerbatim (" GMT_info" ) << " creating GMT Sorter" ;
123124 m_Sorter = new L1MuGMTSorter (*this ); // barrel
124125
125- if (not m_db) {
126+ if (! std::atomic_load (& m_db)) { // Atomically load m_db
126127 auto temp = std::make_shared<L1MuGMTDebugBlock>(m_config->getBxMin (), m_config->getBxMax ());
127- std::shared_ptr<L1MuGMTDebugBlock> empty;
128- std::atomic_compare_exchange_strong (&m_db, &empty, temp);
128+ std::shared_ptr<L1MuGMTDebugBlock> empty = nullptr ; // Explicit nullptr for CAS
129+ std::atomic_compare_exchange_strong_explicit (
130+ &m_db, &empty, temp, std::memory_order_acq_rel, std::memory_order_acquire);
129131 }
130132 usesResource (" L1MuGlobalMuonTrigger" );
131133 // /EventSetup Tokens
0 commit comments