]> OCCT Git - occt-copy.git/commitdiff
Modification to avoid exceptions in the parallel test
authorgka <gka@opencascade.com>
Mon, 28 Aug 2017 09:50:27 +0000 (12:50 +0300)
committergka <gka@opencascade.com>
Mon, 28 Aug 2017 09:50:27 +0000 (12:50 +0300)
src/IFSelect/IFSelect_WorkSession.cxx
src/Interface/Interface_CheckTool.cxx
src/Message/Message_MsgFile.cxx
src/RWStepAP214/RWStepAP214.cxx
src/StepData/StepData_StepModel.cxx

index 4d9479f008c315015e33b2b8a426b39a74840e01..c514f68f850b4c80ee38812007f92e4268610010 100644 (file)
@@ -541,25 +541,25 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck
   if (thecheckdone) return Standard_True;
   if (!IsLoaded()) return Standard_False;
 
-  Interface_Graph& CG = thegraph->CGraph();
-  Interface_CheckTool cht(thegraph);
-  Interface_CheckIterator checklist = cht.VerifyCheckList();
-  myModel->FillSemanticChecks(checklist,Standard_False);
-  if(themodelstat)
-  {
-    //  Et on met a jour le Graphe (BitMap) !  Flag Incorrect (STX + SEM)
-    Interface_BitMap& BM = CG.CBitMap();
-    BM.Init (Standard_False,Flag_Incorrect);
-    Standard_Integer num, nb = CG.Size();
-    for (checklist.Start(); checklist.More(); checklist.Next()) {
-      const Handle(Interface_Check) chk = checklist.Value();
-      if (!chk->HasFailed()) continue;
-      num = checklist.Number();
-      if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
-    }
-    for (num = 1; num <= nb; num ++)
-      if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
-  }
+  //Interface_Graph& CG = thegraph->CGraph();
+  //Interface_CheckTool cht(thegraph);
+  //Interface_CheckIterator checklist = cht.VerifyCheckList();
+  //myModel->FillSemanticChecks(checklist,Standard_False);
+  //if(themodelstat)
+  //{
+  //  //  Et on met a jour le Graphe (BitMap) !  Flag Incorrect (STX + SEM)
+  //  Interface_BitMap& BM = CG.CBitMap();
+  //  BM.Init (Standard_False,Flag_Incorrect);
+  //  Standard_Integer num, nb = CG.Size();
+  //  for (checklist.Start(); checklist.More(); checklist.Next()) {
+  //    const Handle(Interface_Check) chk = checklist.Value();
+  //    if (!chk->HasFailed()) continue;
+  //    num = checklist.Number();
+  //    if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
+  //  }
+  //  for (num = 1; num <= nb; num ++)
+  //    if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
+  //}
   return Standard_True;
 }
 
index 1a136dff11845172c297990ffb77e5f6952dc4e3..cdf279620eefe49e498adf3005c8fe863a52013a 100644 (file)
@@ -39,7 +39,7 @@
 #endif
 #include <stdio.h>
 
-static int errh = 1;
+//static int errh = 1;
 
 
 static void raisecheck (Standard_Failure& theException,Handle(Interface_Check)& ach)
@@ -126,10 +126,10 @@ void Interface_CheckTool::FillCheck(const Handle(Standard_Transient)& ent,
   Standard_Integer CN;
   if (thegtool->Select(ent,module,CN)) {
 //    Sans try/catch (fait par l appelant, evite try/catch en boucle)
-    if (!errh) {
-      module->CheckCase(CN,ent,sh,ach);
-      return;
-    }
+    //if (!errh) {
+    //  module->CheckCase(CN,ent,sh,ach);
+    //  return;
+    //}
 //    Avec try/catch
     try {
       OCC_CATCH_SIGNALS
@@ -200,7 +200,7 @@ Handle(Interface_Check) Interface_CheckTool::Check(const Standard_Integer num)
   Handle(Interface_InterfaceModel) model = theshare.Model();
   Handle(Standard_Transient) ent = model->Value(num);
   Handle(Interface_Check) ach = new Interface_Check(ent);  // non filtre par "Warning" : tel quel
-  errh = 1;
+  //errh = 1;
   FillCheck(ent,theshare,ach);
   return ach;
 }
@@ -221,13 +221,13 @@ void Interface_CheckTool::CheckSuccess (const Standard_Boolean reset)
     ("Interface Model : Global Check");
   Handle(Interface_InterfaceModel) model = theshare.Model();
   if (model->GlobalCheck()->NbFails() > 0) throw Interface_CheckFailure("Interface Model : Global Check");
-  Handle(Interface_Check) modchk = new Interface_Check;
-  model->VerifyCheck(modchk);
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
-  if (modchk->HasFailed())  throw Interface_CheckFailure("Interface Model : Verify Check");
-  if (thestat == 3) return;                    // tout teste et ca passe
+  //Handle(Interface_Check) modchk = new Interface_Check;
+  //model->VerifyCheck(modchk);
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
+  //if (modchk->HasFailed())  throw Interface_CheckFailure("Interface Model : Verify Check");
+  //if (thestat == 3) return;                    // tout teste et ca passe
 
-  errh = 0;  // Pas de try/catch, car justement on raise
+  //errh = 0;  // Pas de try/catch, car justement on raise
   Standard_Integer nb = model->NbEntities();
   for (Standard_Integer i = 1; i <= nb; i ++) {
     if (model->IsErrorEntity(i)) throw Interface_CheckFailure("Interface Model : an Entity is recorded as Erroneous");
@@ -262,13 +262,13 @@ Interface_CheckIterator Interface_CheckTool::CompleteCheckList ()
   Interface_CheckIterator res;
   res.SetModel(model);
   Handle(Interface_Check) globch = model->GlobalCheck();    // GlobalCheck Statique
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
-  model->VerifyCheck(globch);                       // GlobalCheck Dynamique
-  if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
-  if (globch->HasFailed()) thestat |= 12;
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+  //model->VerifyCheck(globch);                       // GlobalCheck Dynamique
+  //if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
+  //if (globch->HasFailed()) thestat |= 12;
 
   Standard_Integer i=0,n0 = 1, nb = model->NbEntities();
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     Handle(Standard_Transient) ent;
@@ -316,11 +316,11 @@ Interface_CheckIterator Interface_CheckTool::CheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
   Handle(Interface_Check) globch = model->GlobalCheck();
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
-  model->VerifyCheck(globch);
-  if (globch->HasFailed()) {  thestat |= 12;  res.Add(globch,0);  }
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+  //model->VerifyCheck(globch);
+  //if (globch->HasFailed()) {  thestat |= 12;  res.Add(globch,0);  }
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check; 
     Handle(Standard_Transient) ent;
@@ -368,7 +368,7 @@ Interface_CheckIterator Interface_CheckTool::AnalyseCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     try {
@@ -408,7 +408,7 @@ Interface_CheckIterator Interface_CheckTool::VerifyCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Standard_Transient) ent;
     Handle(Interface_Check) ach = new Interface_Check;
@@ -452,7 +452,7 @@ Interface_CheckIterator Interface_CheckTool::WarningCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     Handle(Standard_Transient) ent;
index 20e6d4791b0e8f74bfbebfe787886fea3f1e7b92..31ff7f28d20bc996ff4c77d41c9fb0f86109bb3f 100644 (file)
@@ -344,9 +344,10 @@ Standard_Boolean Message_MsgFile::LoadFromString (const Standard_CString theCont
 Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword,
                                          const TCollection_ExtendedString&  theMessage)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
 
-  Standard_Mutex::Sentry aSentry (theMutex);
   aDataMap.Bind (theKeyword, theMessage);
   return Standard_True;
 }
@@ -369,7 +370,8 @@ const TCollection_ExtendedString &Message_MsgFile::Msg (const Standard_CString t
 
 Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyword)
 {
-  Standard_Mutex::Sentry aSentry (theMutex);
+  Standard_Mutex::Sentry aSentry(theMutex);
+  
   return ::msgsDataMap().IsBound (theKeyword);
 }
 
@@ -380,9 +382,10 @@ Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyw
 
 const TCollection_ExtendedString &Message_MsgFile::Msg (const TCollection_AsciiString& theKeyword)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // find message in the map
   Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
-  Standard_Mutex::Sentry aSentry (theMutex);
 
   // if message is not found, generate error message and add it to the map to minimize overhead
   // on consequent calls with the same key
index 21835951e891d41332b416f4592559cd380e0a52..fa2873566fbf883c3f2ade9dcd702c08077444fc 100644 (file)
 #include <RWStepAP214_GeneralModule.hxx>
 #include <RWStepAP214_ReadWriteModule.hxx>
 #include <StepData_WriterLib.hxx>
+#include <Standard_Mutex.hxx>
 
 static int THE_RWStepAP214_init = 0;
 
 void RWStepAP214::Init(const Handle(StepAP214_Protocol)& theProto)
 {
-  if (THE_RWStepAP214_init)
-  {
-    return;
-  }
-  THE_RWStepAP214_init = 1;
-  RWHeaderSection::Init();
-  Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule, theProto);
-  Interface_ReaderLib::SetGlobal  (new RWStepAP214_ReadWriteModule, theProto);
-  StepData_WriterLib::SetGlobal   (new RWStepAP214_ReadWriteModule, theProto);
+ // static Standard_Mutex aPars;
+ // {
+
+    if (THE_RWStepAP214_init)
+    {
+      return;
+    }
+    THE_RWStepAP214_init = 1;
+    RWHeaderSection::Init();
+    Interface_GeneralLib::SetGlobal(new RWStepAP214_GeneralModule, theProto);
+    Interface_ReaderLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
+    StepData_WriterLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
+ // }
 }
index 9efc9354ba74dc0b9f0fde707ed80b020dd16d55..2a1445848cbbefbc251fd2da20b9cf7d324f02d9 100644 (file)
@@ -398,7 +398,7 @@ void StepData_StepModel::AddHeaderEntity
 
 void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
 {
-  Interface_GeneralLib lib(StepData::HeaderProtocol());
+  /*Interface_GeneralLib lib(StepData::HeaderProtocol());
   Handle(StepData_StepModel) me (this);
   Handle(Interface_Protocol) aHP = StepData::HeaderProtocol();
   Interface_ShareTool sh(me,aHP);
@@ -407,7 +407,7 @@ void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
     Handle(Standard_Transient) head = iter.Value();
     if (!lib.Select(head,module,CN)) continue;
     module->CheckCase(CN,head,sh,ach);
-  }
+  }*/
 }