]> OCCT Git - occt-copy.git/commitdiff
Mutex for some static init functions
authoraka <aka@opencascade.com>
Thu, 24 Aug 2017 11:30:23 +0000 (14:30 +0300)
committeraka <aka@opencascade.com>
Thu, 24 Aug 2017 11:30:23 +0000 (14:30 +0300)
src/Message/Message_MsgFile.cxx
src/STEPControl/STEPControl_Controller.cxx

index 123822d3d9212e999982496c752cf6d57cca2e0c..20e6d4791b0e8f74bfbebfe787886fea3f1e7b92 100644 (file)
@@ -277,6 +277,7 @@ Standard_Boolean Message_MsgFile::LoadFromEnv (const Standard_CString theEnvName
                                                const Standard_CString theFileName,
                                                const Standard_CString theLangExt)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   TCollection_AsciiString aLangExt (theLangExt != NULL ? theLangExt : "");
   if (aLangExt.IsEmpty())
   {
index c8315b3977357948484ea48595d6a27688993fcc..ab60b0e27278c01459503be7510d39ddb30fd7fe 100644 (file)
@@ -32,6 +32,7 @@
 #include <ShapeProcess_OperLibrary.hxx>
 #include <Standard_Type.hxx>
 #include <Standard_Version.hxx>
+#include <Standard_Mutex.hxx>
 #include <StepAP214_Protocol.hxx>
 #include <STEPControl_ActorRead.hxx>
 #include <STEPControl_ActorWrite.hxx>
@@ -62,10 +63,14 @@ IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
 STEPControl_Controller::STEPControl_Controller()
   : XSControl_Controller("STEP", "step")
 {
-  RWHeaderSection::Init();
-
   myAdaptorProtocol = new StepAP214_Protocol();
-  RWStepAP214::Init(Handle(StepAP214_Protocol)::DownCast(myAdaptorProtocol));
+
+  static Standard_Mutex aPars;
+  {
+    Standard_Mutex::Sentry aLock(aPars);
+    RWHeaderSection::Init();
+    RWStepAP214::Init(Handle(StepAP214_Protocol)::DownCast(myAdaptorProtocol));
+  }
 
   Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
   myAdaptorWrite = ActWrite;