CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Xerces.cc
Go to the documentation of this file.
2 #include <xercesc/util/PlatformUtils.hpp>
3 #include <mutex>
4 #include <thread>
5 XERCES_CPP_NAMESPACE_USE
6 
7 namespace cms {
8  namespace concurrency {
9  namespace {
10  std::mutex g_xerces_mutex;
11  }
12  // We need to make sure these these are serialized are only called by one
13  // thread at the time. Until the first Init succeeds the other threads
14  // should not be allowed to proceed. We also do not want two different
15  // threads calling Init and Finalize at the same time. We therefore simply
16  // use a global mutex to serialize everything.
18  std::unique_lock<std::mutex> l(g_xerces_mutex);
19  XMLPlatformUtils::Initialize();
20  }
21 
22  void xercesTerminate() {
23  std::unique_lock<std::mutex> l(g_xerces_mutex);
24  XMLPlatformUtils::Terminate();
25  }
26  }
27 }
28 
static boost::mutex mutex
Definition: LHEProxy.cc:11
void xercesTerminate()
Definition: Xerces.cc:22
void xercesInitialize()
Definition: Xerces.cc:17