OCC22579 Improving thread-safety of GeomFill
authorRLN and KGV <>
Thu, 14 Jul 2011 13:02:13 +0000 (13:02 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:29:23 +0000 (19:29 +0400)
src/BOPTest/BOPTest_BOPCommands.cxx
src/BOPTest/BOPTest_LowCommands.cxx
src/GeomFill/GeomFill.cxx
src/Standard/FILES
src/Standard/Standard_Static.hxx [deleted file]

index 4a8049d..3ffa9f5 100755 (executable)
 #include <BRepAlgoAPI_Fuse.hxx>
 #include <BRepAlgoAPI_Cut.hxx>
 
-#include <TColStd_IndexedMapOfInteger.hxx>
-
-
-
-//XX
-// CHRONOMETER
-//
-#include <Standard_Static.hxx>
 #include <OSD_Chronometer.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
 
-
-Standard_STATIC(OSD_Chronometer, S_Chrono);
+static OSD_Chronometer DRAW_BOP_CHRONO;
 static void StartChrono();
 static void StopChrono(Draw_Interpretor&); 
 Standard_Integer btimesum (Draw_Interpretor& , Standard_Integer n, const char** a);
@@ -752,8 +744,8 @@ void StartChrono()
   char *xr=getenv ("BOPCHRONO");
   if (xr!=NULL){
     if (!strcmp (xr, "yes")){
-      S_Chrono().Reset();
-      S_Chrono().Start();
+      DRAW_BOP_CHRONO.Reset();
+      DRAW_BOP_CHRONO.Start();
     }
   }
 }
@@ -768,8 +760,8 @@ void StopChrono(Draw_Interpretor& di)
   if (xr!=NULL){
     if (!strcmp (xr, "yes")) {
       Standard_Real Chrono;
-      S_Chrono().Stop();
-      S_Chrono().Show(Chrono);
+      DRAW_BOP_CHRONO.Stop();
+      DRAW_BOP_CHRONO.Show(Chrono);
       //
       char *aFileName=getenv("BOPCHRONOFILE");
       if (aFileName!=NULL){
index c68194b..f39c12e 100755 (executable)
@@ -55,7 +55,6 @@
 #include <IntTools_Context.hxx>
 #include <IntTools_FClass2d.hxx>
 #include <gp_Pnt2d.hxx>
-#include <Standard_Static.hxx>
 #include <OSD_Chronometer.hxx>
 
 #include <BRepTools.hxx>
index a381250..44cf0e0 100755 (executable)
 #include <GeomFill_PolynomialConvertor.hxx>
 #include <GeomFill_QuasiAngularConvertor.hxx>
 #include <Precision.hxx>
-#include <Standard_Static.hxx>
 
-// La classe de convertion
-Standard_STATIC (GeomFill_PolynomialConvertor, PConvertor);
-Standard_STATIC (GeomFill_QuasiAngularConvertor, QConvertor);
 
 //=======================================================================
 //function : Surface
@@ -390,15 +385,17 @@ void GeomFill::GetCircle( const Convert_ParameterisationType  TConv,
 
   switch (TConv) {
   case Convert_QuasiAngular:
-    {   // On utilise le bon  "Convertor" 
-      if (!QConvertor().Initialized()) QConvertor().Init();
-      QConvertor().Section(pts1, Center, nplan, Angle, Poles, Weights);
+    {
+      GeomFill_QuasiAngularConvertor QConvertor;
+      QConvertor.Init();
+      QConvertor.Section(pts1, Center, nplan, Angle, Poles, Weights);
       break;
     }
   case Convert_Polynomial:
-    { // On utilise le bon  "Convertor" 
-      if (!PConvertor().Initialized()) PConvertor().Init();
-      PConvertor().Section(pts1, Center, nplan, Angle, Poles);
+    { 
+      GeomFill_PolynomialConvertor PConvertor;
+      PConvertor.Init();
+      PConvertor.Section(pts1, Center, nplan, Angle, Poles);
       Weights.Init(1);
       break;
     }
@@ -495,8 +492,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType  TConv,
   switch (TConv) {
   case Convert_QuasiAngular:
     {
-      if (!QConvertor().Initialized()) QConvertor().Init();
-      QConvertor().Section(pts1, tang1, 
+      GeomFill_QuasiAngularConvertor QConvertor;
+      QConvertor.Init();
+      QConvertor.Section(pts1, tang1, 
                        Center, DCenter, 
                        nplan, dnplan,
                        Angle, DAngle,
@@ -506,8 +504,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType  TConv,
   }
   case Convert_Polynomial:
     {
-      if (!PConvertor().Initialized()) PConvertor().Init();
-      PConvertor().Section(pts1, tang1, 
+      GeomFill_PolynomialConvertor PConvertor;
+      PConvertor.Init();
+      PConvertor.Section(pts1, tang1, 
                        Center, DCenter, 
                        nplan, dnplan,
                        Angle, DAngle,
@@ -647,8 +646,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType  TConv,
   switch (TConv) {
   case Convert_QuasiAngular:
     {
-      if (!QConvertor().Initialized()) QConvertor().Init();
-      QConvertor().Section(pts1, tang1, Dtang1,
+      GeomFill_QuasiAngularConvertor QConvertor;
+      QConvertor.Init();
+      QConvertor.Section(pts1, tang1, Dtang1,
                           Center, DCenter, D2Center,
                           nplan, dnplan, d2nplan,
                           Angle, DAngle, D2Angle,
@@ -658,8 +658,9 @@ Standard_Boolean GeomFill::GetCircle(const Convert_ParameterisationType  TConv,
   }
   case Convert_Polynomial:
     {
-      if (!PConvertor().Initialized()) PConvertor().Init();
-      PConvertor().Section(pts1, tang1, Dtang1,
+      GeomFill_PolynomialConvertor PConvertor;
+      PConvertor.Init();
+      PConvertor.Section(pts1, tang1, Dtang1,
                           Center, DCenter, D2Center,
                           nplan, dnplan,  d2nplan,
                           Angle, DAngle, D2Angle,
index ee815d6..ddc3121 100755 (executable)
@@ -48,7 +48,6 @@ Standard_SStream.hxx
 Standard_ShallowDump.cxx
 Standard_ShortReal.cxx
 Standard_ShortReal.hxx
-Standard_Static.hxx
 Standard_Stream.hxx
 Standard_String.hxx
 Standard_Transient.hxx
diff --git a/src/Standard/Standard_Static.hxx b/src/Standard/Standard_Static.hxx
deleted file mode 100755 (executable)
index 6c74692..0000000
+++ /dev/null
@@ -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; \
-                                                 }
-
-
-