From 4f90ff1f516ea840f8abaaf2982cfcb54d11c08e Mon Sep 17 00:00:00 2001 From: aka Date: Thu, 24 Aug 2017 14:30:23 +0300 Subject: [PATCH] Mutex for some static init functions --- src/Message/Message_MsgFile.cxx | 1 + src/STEPControl/STEPControl_Controller.cxx | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Message/Message_MsgFile.cxx b/src/Message/Message_MsgFile.cxx index 123822d3d9..20e6d4791b 100644 --- a/src/Message/Message_MsgFile.cxx +++ b/src/Message/Message_MsgFile.cxx @@ -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()) { diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index c8315b3977..ab60b0e272 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -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; -- 2.39.5