From 3bae07fb6ce793eb4f73b70e603358086adefb83 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 24 Oct 2023 15:12:22 -0600 Subject: [PATCH] Move a variable to the .cc file. --- include/deal.II/fe/fe_tools.templates.h | 15 ++++++--------- source/fe/fe_tools.cc | 13 +++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index 82469926cd..5125e160d3 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -1220,15 +1220,12 @@ namespace FETools } - // have a lock that guarantees that at most one thread is changing - // and accessing the fe_name_map variable. make this lock local to - // this file. - // - // This variable is declared static (even though - // it belongs to an internal namespace) in order to make icc happy - // (which otherwise reports a multiply defined symbol when linking - // libraries for more than one space dimension together) - static std::shared_mutex fe_name_map_lock; + // Have a lock that guarantees that at most one thread is changing + // and accessing the fe_name_map variable. The variable + // is declared 'extern' here because we are in a .h file, but + // it really needs to be defined in a .cc file (and indeed we have + // the definition there). + extern std::shared_mutex fe_name_map_lock; // This is the map used by FETools::get_fe_by_name and // FETools::add_fe_name. It is only accessed by functions in this diff --git a/source/fe/fe_tools.cc b/source/fe/fe_tools.cc index 5b543875ad..8c8638dfe6 100644 --- a/source/fe/fe_tools.cc +++ b/source/fe/fe_tools.cc @@ -18,6 +18,19 @@ DEAL_II_NAMESPACE_OPEN + +namespace FETools +{ + namespace internal + { + namespace FEToolsAddFENameHelper + { + std::shared_mutex fe_name_map_lock; + } + } // namespace internal +} // namespace FETools + + /*-------------- Explicit Instantiations -------------------------------*/ #include "fe_tools.inst" -- 2.39.5