0022550: Fixing data races
[occt.git] / src / Approx / Approx_ComputeLine.gxx
index 49ca4d6..0788363 100755 (executable)
@@ -23,9 +23,6 @@
 
 #include <stdio.h>
 
-static Standard_Boolean IsClear = Standard_False;
-static Standard_Integer nbML = 0;
-
 #ifdef DEB
 static Standard_Boolean mydebug = Standard_False;
 
@@ -391,6 +388,8 @@ Approx_ComputeLine::Approx_ComputeLine
                     const Standard_Integer NbIterations,
                     const Standard_Boolean cutting,
                     const Standard_Boolean Squares)
+: myMultiLineNb (0),
+  myIsClear (Standard_False)
 {
   myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(), 
                                           Parameters.Upper());
@@ -422,6 +421,8 @@ Approx_ComputeLine::Approx_ComputeLine
                     const Standard_Integer NbIterations,
                     const Standard_Boolean cutting,
                     const Standard_Boolean Squares)
+: myMultiLineNb (0),
+  myIsClear (Standard_False)
 {
   myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(), 
                                           Parameters.Upper());
@@ -451,6 +452,8 @@ Approx_ComputeLine::Approx_ComputeLine
                     const Standard_Boolean cutting,
                     const Approx_ParametrizationType parametrization,
                     const Standard_Boolean Squares)
+: myMultiLineNb (0),
+  myIsClear (Standard_False)
 {
   myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
   Par = parametrization;
@@ -477,6 +480,8 @@ Approx_ComputeLine::Approx_ComputeLine
                     const Standard_Boolean cutting,
                     const Approx_ParametrizationType parametrization,
                     const Standard_Boolean Squares)
+: myMultiLineNb (0),
+  myIsClear (Standard_False)
 {
   myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
   alldone = Standard_False;
@@ -501,14 +506,15 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
 #ifdef DEB
   if (mydebug) DUMP(Line);
 #endif
-  if (!IsClear) {
+  if (!myIsClear)
+  {
     myMultiCurves.Clear();
     myPar.Clear();
     Tolers3d.Clear();
     Tolers2d.Clear();
-    nbML = 0;
+    myMultiLineNb = 0;
   }
-  else  IsClear = Standard_False;
+  else myIsClear = Standard_False;
 
   Standard_Integer i, nbp, Thefirstpt, Thelastpt, oldlastpt;
   Standard_Boolean Finish = Standard_False,
@@ -613,8 +619,8 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
            -LineTool::LastPoint(OtherLine);
 
          //-- Si MakeML a echoue   on retourne une ligne vide
-         
-         if(    (nbpdsotherligne == 0) || nbML >= 3) { 
+         if ((nbpdsotherligne == 0) || myMultiLineNb >= 3)
+         {
            FailOnPointsAdded = Standard_True; 
            //-- cout<<" ** ApproxComputeLine MakeML Echec ** LBR lbr "<<endl;
            if (myfirstpt == mylastpt) break;  // Pour etre sur de ne pas 
@@ -676,12 +682,13 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
            mylastpt = Thelastpt;
            
          }
-         else { 
-           IsClear = Standard_True;
-           nbML++;
+         else
+         {
+           myIsClear = Standard_True;
+           ++myMultiLineNb;
            Perform(OtherLine);
            myfirstpt = mylastpt;
-           mylastpt = Thelastpt; 
+           mylastpt = Thelastpt;
          }
        }