CMS 3D CMS Logo

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