1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

OCC22579 Improving thread-safety of GeomFill

This commit is contained in:
RLN and KGV 2011-07-14 13:02:13 +00:00 committed by bugmaster
parent 3b5410151b
commit f69df44281
5 changed files with 26 additions and 49 deletions

View File

@ -58,18 +58,10 @@
#include <BRepAlgoAPI_Fuse.hxx> #include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx> #include <BRepAlgoAPI_Cut.hxx>
#include <OSD_Chronometer.hxx>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
static OSD_Chronometer DRAW_BOP_CHRONO;
//XX
// CHRONOMETER
//
#include <Standard_Static.hxx>
#include <OSD_Chronometer.hxx>
Standard_STATIC(OSD_Chronometer, S_Chrono);
static void StartChrono(); static void StartChrono();
static void StopChrono(Draw_Interpretor&); static void StopChrono(Draw_Interpretor&);
Standard_Integer btimesum (Draw_Interpretor& , Standard_Integer n, const char** a); Standard_Integer btimesum (Draw_Interpretor& , Standard_Integer n, const char** a);
@ -752,8 +744,8 @@ void StartChrono()
char *xr=getenv ("BOPCHRONO"); char *xr=getenv ("BOPCHRONO");
if (xr!=NULL){ if (xr!=NULL){
if (!strcmp (xr, "yes")){ if (!strcmp (xr, "yes")){
S_Chrono().Reset(); DRAW_BOP_CHRONO.Reset();
S_Chrono().Start(); DRAW_BOP_CHRONO.Start();
} }
} }
} }
@ -768,8 +760,8 @@ void StopChrono(Draw_Interpretor& di)
if (xr!=NULL){ if (xr!=NULL){
if (!strcmp (xr, "yes")) { if (!strcmp (xr, "yes")) {
Standard_Real Chrono; Standard_Real Chrono;
S_Chrono().Stop(); DRAW_BOP_CHRONO.Stop();
S_Chrono().Show(Chrono); DRAW_BOP_CHRONO.Show(Chrono);
// //
char *aFileName=getenv("BOPCHRONOFILE"); char *aFileName=getenv("BOPCHRONOFILE");
if (aFileName!=NULL){ if (aFileName!=NULL){

View File

@ -55,7 +55,6 @@
#include <IntTools_Context.hxx> #include <IntTools_Context.hxx>
#include <IntTools_FClass2d.hxx> #include <IntTools_FClass2d.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <Standard_Static.hxx>
#include <OSD_Chronometer.hxx> #include <OSD_Chronometer.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>

View File

@ -26,12 +26,7 @@
#include <GeomFill_PolynomialConvertor.hxx> #include <GeomFill_PolynomialConvertor.hxx>
#include <GeomFill_QuasiAngularConvertor.hxx> #include <GeomFill_QuasiAngularConvertor.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <Standard_Static.hxx>
// La classe de convertion
Standard_STATIC (GeomFill_PolynomialConvertor, PConvertor);
Standard_STATIC (GeomFill_QuasiAngularConvertor, QConvertor);
//======================================================================= //=======================================================================
//function : Surface //function : Surface
@ -390,15 +385,17 @@ void GeomFill::GetCircle( const Convert_ParameterisationType TConv,
switch (TConv) { switch (TConv) {
case Convert_QuasiAngular: case Convert_QuasiAngular:
{ // On utilise le bon "Convertor" {
if (!QConvertor().Initialized()) QConvertor().Init(); GeomFill_QuasiAngularConvertor QConvertor;
QConvertor().Section(pts1, Center, nplan, Angle, Poles, Weights); QConvertor.Init();
QConvertor.Section(pts1, Center, nplan, Angle, Poles, Weights);
break; break;
} }
case Convert_Polynomial: case Convert_Polynomial:
{ // On utilise le bon "Convertor" {
if (!PConvertor().Initialized()) PConvertor().Init(); GeomFill_PolynomialConvertor PConvertor;
PConvertor().Section(pts1, Center, nplan, Angle, Poles); PConvertor.Init();
PConvertor.Section(pts1, Center, nplan, Angle, Poles);
Weights.Init(1); Weights.Init(1);
break; break;
} }
@ -495,8 +492,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType TConv,
switch (TConv) { switch (TConv) {
case Convert_QuasiAngular: case Convert_QuasiAngular:
{ {
if (!QConvertor().Initialized()) QConvertor().Init(); GeomFill_QuasiAngularConvertor QConvertor;
QConvertor().Section(pts1, tang1, QConvertor.Init();
QConvertor.Section(pts1, tang1,
Center, DCenter, Center, DCenter,
nplan, dnplan, nplan, dnplan,
Angle, DAngle, Angle, DAngle,
@ -506,8 +504,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType TConv,
} }
case Convert_Polynomial: case Convert_Polynomial:
{ {
if (!PConvertor().Initialized()) PConvertor().Init(); GeomFill_PolynomialConvertor PConvertor;
PConvertor().Section(pts1, tang1, PConvertor.Init();
PConvertor.Section(pts1, tang1,
Center, DCenter, Center, DCenter,
nplan, dnplan, nplan, dnplan,
Angle, DAngle, Angle, DAngle,
@ -647,8 +646,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType TConv,
switch (TConv) { switch (TConv) {
case Convert_QuasiAngular: case Convert_QuasiAngular:
{ {
if (!QConvertor().Initialized()) QConvertor().Init(); GeomFill_QuasiAngularConvertor QConvertor;
QConvertor().Section(pts1, tang1, Dtang1, QConvertor.Init();
QConvertor.Section(pts1, tang1, Dtang1,
Center, DCenter, D2Center, Center, DCenter, D2Center,
nplan, dnplan, d2nplan, nplan, dnplan, d2nplan,
Angle, DAngle, D2Angle, Angle, DAngle, D2Angle,
@ -658,8 +658,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType TConv,
} }
case Convert_Polynomial: case Convert_Polynomial:
{ {
if (!PConvertor().Initialized()) PConvertor().Init(); GeomFill_PolynomialConvertor PConvertor;
PConvertor().Section(pts1, tang1, Dtang1, PConvertor.Init();
PConvertor.Section(pts1, tang1, Dtang1,
Center, DCenter, D2Center, Center, DCenter, D2Center,
nplan, dnplan, d2nplan, nplan, dnplan, d2nplan,
Angle, DAngle, D2Angle, Angle, DAngle, D2Angle,

View File

@ -48,7 +48,6 @@ Standard_SStream.hxx
Standard_ShallowDump.cxx Standard_ShallowDump.cxx
Standard_ShortReal.cxx Standard_ShortReal.cxx
Standard_ShortReal.hxx Standard_ShortReal.hxx
Standard_Static.hxx
Standard_Stream.hxx Standard_Stream.hxx
Standard_String.hxx Standard_String.hxx
Standard_Transient.hxx Standard_Transient.hxx

View File

@ -1,14 +0,0 @@
#define Standard_STATIC(type,name) type& name() \
{ \
static type _##name; \
return _##name; \
}
#define Standard_STATIC_INIT(type,name,initfunc) type& name() \
{ \
static type _##name = initfunc; \
return _##name; \
}