1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Modification to avoid exceptions in the parallel test

This commit is contained in:
gka
2017-08-28 12:50:27 +03:00
parent 108fd5ccca
commit cf6a89b0e9
5 changed files with 65 additions and 57 deletions

View File

@@ -541,25 +541,25 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck
if (thecheckdone) return Standard_True; if (thecheckdone) return Standard_True;
if (!IsLoaded()) return Standard_False; if (!IsLoaded()) return Standard_False;
Interface_Graph& CG = thegraph->CGraph(); //Interface_Graph& CG = thegraph->CGraph();
Interface_CheckTool cht(thegraph); //Interface_CheckTool cht(thegraph);
Interface_CheckIterator checklist = cht.VerifyCheckList(); //Interface_CheckIterator checklist = cht.VerifyCheckList();
myModel->FillSemanticChecks(checklist,Standard_False); //myModel->FillSemanticChecks(checklist,Standard_False);
if(themodelstat) //if(themodelstat)
{ //{
// Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM) // // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM)
Interface_BitMap& BM = CG.CBitMap(); // Interface_BitMap& BM = CG.CBitMap();
BM.Init (Standard_False,Flag_Incorrect); // BM.Init (Standard_False,Flag_Incorrect);
Standard_Integer num, nb = CG.Size(); // Standard_Integer num, nb = CG.Size();
for (checklist.Start(); checklist.More(); checklist.Next()) { // for (checklist.Start(); checklist.More(); checklist.Next()) {
const Handle(Interface_Check) chk = checklist.Value(); // const Handle(Interface_Check) chk = checklist.Value();
if (!chk->HasFailed()) continue; // if (!chk->HasFailed()) continue;
num = checklist.Number(); // num = checklist.Number();
if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect); // if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
} // }
for (num = 1; num <= nb; num ++) // for (num = 1; num <= nb; num ++)
if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect); // if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
} //}
return Standard_True; return Standard_True;
} }

View File

@@ -39,7 +39,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
static int errh = 1; //static int errh = 1;
static void raisecheck (Standard_Failure& theException,Handle(Interface_Check)& ach) 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; Standard_Integer CN;
if (thegtool->Select(ent,module,CN)) { if (thegtool->Select(ent,module,CN)) {
// Sans try/catch (fait par l appelant, evite try/catch en boucle) // Sans try/catch (fait par l appelant, evite try/catch en boucle)
if (!errh) { //if (!errh) {
module->CheckCase(CN,ent,sh,ach); // module->CheckCase(CN,ent,sh,ach);
return; // return;
} //}
// Avec try/catch // Avec try/catch
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
@@ -200,7 +200,7 @@ Handle(Interface_Check) Interface_CheckTool::Check(const Standard_Integer num)
Handle(Interface_InterfaceModel) model = theshare.Model(); Handle(Interface_InterfaceModel) model = theshare.Model();
Handle(Standard_Transient) ent = model->Value(num); Handle(Standard_Transient) ent = model->Value(num);
Handle(Interface_Check) ach = new Interface_Check(ent); // non filtre par "Warning" : tel quel Handle(Interface_Check) ach = new Interface_Check(ent); // non filtre par "Warning" : tel quel
errh = 1; //errh = 1;
FillCheck(ent,theshare,ach); FillCheck(ent,theshare,ach);
return ach; return ach;
} }
@@ -221,13 +221,13 @@ void Interface_CheckTool::CheckSuccess (const Standard_Boolean reset)
("Interface Model : Global Check"); ("Interface Model : Global Check");
Handle(Interface_InterfaceModel) model = theshare.Model(); Handle(Interface_InterfaceModel) model = theshare.Model();
if (model->GlobalCheck()->NbFails() > 0) throw Interface_CheckFailure("Interface Model : Global Check"); if (model->GlobalCheck()->NbFails() > 0) throw Interface_CheckFailure("Interface Model : Global Check");
Handle(Interface_Check) modchk = new Interface_Check; //Handle(Interface_Check) modchk = new Interface_Check;
model->VerifyCheck(modchk); //model->VerifyCheck(modchk);
if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk); //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
if (modchk->HasFailed()) throw Interface_CheckFailure("Interface Model : Verify Check"); //if (modchk->HasFailed()) throw Interface_CheckFailure("Interface Model : Verify Check");
if (thestat == 3) return; // tout teste et ca passe //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(); Standard_Integer nb = model->NbEntities();
for (Standard_Integer i = 1; i <= nb; i ++) { for (Standard_Integer i = 1; i <= nb; i ++) {
if (model->IsErrorEntity(i)) throw Interface_CheckFailure("Interface Model : an Entity is recorded as Erroneous"); 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; Interface_CheckIterator res;
res.SetModel(model); res.SetModel(model);
Handle(Interface_Check) globch = model->GlobalCheck(); // GlobalCheck Statique Handle(Interface_Check) globch = model->GlobalCheck(); // GlobalCheck Statique
if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch); //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
model->VerifyCheck(globch); // GlobalCheck Dynamique //model->VerifyCheck(globch); // GlobalCheck Dynamique
if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0); //if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
if (globch->HasFailed()) thestat |= 12; //if (globch->HasFailed()) thestat |= 12;
Standard_Integer i=0,n0 = 1, nb = model->NbEntities(); Standard_Integer i=0,n0 = 1, nb = model->NbEntities();
errh = 0; //errh = 0;
while (n0 <= nb) { while (n0 <= nb) {
Handle(Interface_Check) ach = new Interface_Check; Handle(Interface_Check) ach = new Interface_Check;
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
@@ -316,11 +316,11 @@ Interface_CheckIterator Interface_CheckTool::CheckList ()
res.SetModel(model); res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities(); Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
Handle(Interface_Check) globch = model->GlobalCheck(); Handle(Interface_Check) globch = model->GlobalCheck();
if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch); //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
model->VerifyCheck(globch); //model->VerifyCheck(globch);
if (globch->HasFailed()) { thestat |= 12; res.Add(globch,0); } //if (globch->HasFailed()) { thestat |= 12; res.Add(globch,0); }
errh = 0; //errh = 0;
while (n0 <= nb) { while (n0 <= nb) {
Handle(Interface_Check) ach = new Interface_Check; Handle(Interface_Check) ach = new Interface_Check;
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
@@ -368,7 +368,7 @@ Interface_CheckIterator Interface_CheckTool::AnalyseCheckList ()
res.SetModel(model); res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities(); Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
errh = 0; //errh = 0;
while (n0 <= nb) { while (n0 <= nb) {
Handle(Interface_Check) ach = new Interface_Check; Handle(Interface_Check) ach = new Interface_Check;
try { try {
@@ -408,7 +408,7 @@ Interface_CheckIterator Interface_CheckTool::VerifyCheckList ()
res.SetModel(model); res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities(); Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
errh = 0; //errh = 0;
while (n0 <= nb) { while (n0 <= nb) {
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
Handle(Interface_Check) ach = new Interface_Check; Handle(Interface_Check) ach = new Interface_Check;
@@ -452,7 +452,7 @@ Interface_CheckIterator Interface_CheckTool::WarningCheckList ()
res.SetModel(model); res.SetModel(model);
Standard_Integer i=0, n0 = 1, nb = model->NbEntities(); Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
errh = 0; //errh = 0;
while (n0 <= nb) { while (n0 <= nb) {
Handle(Interface_Check) ach = new Interface_Check; Handle(Interface_Check) ach = new Interface_Check;
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;

View File

@@ -344,9 +344,10 @@ Standard_Boolean Message_MsgFile::LoadFromString (const Standard_CString theCont
Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword, Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword,
const TCollection_ExtendedString& theMessage) const TCollection_ExtendedString& theMessage)
{ {
Standard_Mutex::Sentry aSentry(theMutex);
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap(); Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
Standard_Mutex::Sentry aSentry (theMutex);
aDataMap.Bind (theKeyword, theMessage); aDataMap.Bind (theKeyword, theMessage);
return Standard_True; 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_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyword)
{ {
Standard_Mutex::Sentry aSentry (theMutex); Standard_Mutex::Sentry aSentry(theMutex);
return ::msgsDataMap().IsBound (theKeyword); 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) const TCollection_ExtendedString &Message_MsgFile::Msg (const TCollection_AsciiString& theKeyword)
{ {
Standard_Mutex::Sentry aSentry(theMutex);
// find message in the map // find message in the map
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap(); 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 // if message is not found, generate error message and add it to the map to minimize overhead
// on consequent calls with the same key // on consequent calls with the same key

View File

@@ -19,18 +19,23 @@
#include <RWStepAP214_GeneralModule.hxx> #include <RWStepAP214_GeneralModule.hxx>
#include <RWStepAP214_ReadWriteModule.hxx> #include <RWStepAP214_ReadWriteModule.hxx>
#include <StepData_WriterLib.hxx> #include <StepData_WriterLib.hxx>
#include <Standard_Mutex.hxx>
static int THE_RWStepAP214_init = 0; static int THE_RWStepAP214_init = 0;
void RWStepAP214::Init(const Handle(StepAP214_Protocol)& theProto) void RWStepAP214::Init(const Handle(StepAP214_Protocol)& theProto)
{ {
if (THE_RWStepAP214_init) // static Standard_Mutex aPars;
{ // {
return;
} if (THE_RWStepAP214_init)
THE_RWStepAP214_init = 1; {
RWHeaderSection::Init(); return;
Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule, theProto); }
Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule, theProto); THE_RWStepAP214_init = 1;
StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule, theProto); RWHeaderSection::Init();
Interface_GeneralLib::SetGlobal(new RWStepAP214_GeneralModule, theProto);
Interface_ReaderLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
StepData_WriterLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
// }
} }

View File

@@ -398,7 +398,7 @@ void StepData_StepModel::AddHeaderEntity
void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const 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(StepData_StepModel) me (this);
Handle(Interface_Protocol) aHP = StepData::HeaderProtocol(); Handle(Interface_Protocol) aHP = StepData::HeaderProtocol();
Interface_ShareTool sh(me,aHP); Interface_ShareTool sh(me,aHP);
@@ -407,7 +407,7 @@ void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
Handle(Standard_Transient) head = iter.Value(); Handle(Standard_Transient) head = iter.Value();
if (!lib.Select(head,module,CN)) continue; if (!lib.Select(head,module,CN)) continue;
module->CheckCase(CN,head,sh,ach); module->CheckCase(CN,head,sh,ach);
} }*/
} }