From 56e88ad254879d6e9a40e1d3770dd11bc7dcce1d Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Fri, 19 Jun 2020 23:01:48 +0200 Subject: [PATCH] TrigPSC: Suppress thread-safety checker warning. An uncoming change to the thread-safety checker will generate warnings for virtual calls to unsafe functions. This then gets a warning for the call to ITrigEventLoopMgr::prepareForRun in Psc::prepareForRun. Perhaps that latter function should also be marked NOT_THREAD_SAFE, but that's awkward since the base class defining this interface is in hltinterface. Just suppress the warning for now. --- HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx index cd0625d453e..8135e5866e3 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx +++ b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx @@ -44,6 +44,8 @@ #include <boost/property_tree/xml_parser.hpp> +#include "CxxUtils/checker_macros.h" + using namespace boost::property_tree; namespace @@ -523,7 +525,20 @@ bool psc::Psc::prepareForRun (const ptree& args) } // bind args to prepareForRun - auto prep = [&args](ITrigEventLoopMgr* mgr){return mgr->prepareForRun(args);}; + auto prep = [&args](ITrigEventLoopMgr* mgr) { + // FIXME: ITrigEventLookMgr::prepareForRun is declared NOT_THREAD_SAFE. + // Probably this method shoud also be NOT_THREAD_SAFE, but that's + // awkward because it implements a tdaq interface from hltinterface. + StatusCode ret ATLAS_THREAD_SAFE = mgr->prepareForRun (args); + + // This dance is needed to prevent RV optimization. + // Otherwise, the optimizer loses the ATLAS_THREAD_SAFE attribute +e // on RET before the thread-safety checker gets to see the code. + if (ret.isSuccess()) { + return StatusCode (StatusCode::SUCCESS); + } + return ret; + }; if(!callOnEventLoopMgr<ITrigEventLoopMgr>(prep, "prepareForRun").isSuccess()) { ERS_PSC_ERROR("Error preparing the EventLoopMgr"); -- GitLab