From 54742397af7e23b654c7d6b2494823636efb1151 Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Mon, 23 Nov 2020 17:20:13 +0100
Subject: [PATCH] AsgTools: Hack to avoid TLS slowdown.

Ensure that TLS defined in this library actually gets used.
Avoids a potential slowdown in accessing TLS seen in simualation.
See ATLASSIM-4932.
---
 .../AsgTools/Root/MessageCheckAsgTools.cxx          | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Control/AthToolSupport/AsgTools/Root/MessageCheckAsgTools.cxx b/Control/AthToolSupport/AsgTools/Root/MessageCheckAsgTools.cxx
index 5f10cc3fe4e..5351b2a36eb 100644
--- a/Control/AthToolSupport/AsgTools/Root/MessageCheckAsgTools.cxx
+++ b/Control/AthToolSupport/AsgTools/Root/MessageCheckAsgTools.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /// @author Nils Krumnack
@@ -23,3 +23,14 @@ namespace asg
   ANA_MSG_SOURCE (msgProperty, "AsgTools.Property")
   ANA_MSG_SOURCE (msgToolHandle, "AsgTools.AnaToolHandle")
 }
+
+// Ensure that TLS defined in this library actually gets used.
+// Avoids a potential slowdown in accessing TLS seen in simualation.
+// See ATLASSIM-4932.
+namespace {
+[[maybe_unused]]
+thread_local int tlsDum;
+[[maybe_unused]]
+const int& msgDumRef = tlsDum;
+}
+
-- 
GitLab