diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_kpart.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_kpart.cxx index 94b16fbaa2..93c2eef937 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_kpart.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_kpart.cxx @@ -38,7 +38,7 @@ extern bool TopOpeBRep_GetcontextNEWKP(); // VP is the vp on which was computed the last CPI. // if no CPI is computed yet, = 0. -static int STATIC_lastVPind; +static thread_local int STATIC_lastVPind; // per-thread cross-call cache #define M_FORWARD(st) (st == TopAbs_FORWARD) #define M_REVERSED(st) (st == TopAbs_REVERSED) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx index d866d860a2..a8c5c95b2b 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepBuild/TopOpeBRepBuild_Builder.cxx @@ -70,7 +70,8 @@ Standard_EXPORT void debspf(const int i) } #endif -static int STATIC_SOLIDINDEX = 0; +// Per-thread: a SplitSolid/FillSolid state flag; sharing it races concurrent builds. +static thread_local int STATIC_SOLIDINDEX = 0; //================================================================================================= diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx index 9b099dbcc9..08e0bb20a7 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_ConstRad.cxx @@ -138,13 +138,12 @@ bool BlendFunc_ConstRad::ComputeValues(const math_Vector& X, const bool byParam, const double Param) { - // static declaration to avoid systematic reallocation - - static gp_Vec d3u1, d3v1, d3uuv1, d3uvv1, d3u2, d3v2, d3uuv2, d3uvv2; - static gp_Vec d1gui, d2gui, d3gui; - static gp_Pnt ptgui; - static double invnormtg, dinvnormtg; - double T = Param, aux; + // Per-thread scratch, reused across calls via the t_OK / myX_OK guards below. + static thread_local gp_Vec d3u1, d3v1, d3uuv1, d3uvv1, d3u2, d3v2, d3uuv2, d3uvv2; + static thread_local gp_Vec d1gui, d2gui, d3gui; + static thread_local gp_Pnt ptgui; + static thread_local double invnormtg, dinvnormtg; + double T = Param, aux; // Case of implicite parameter if (!byParam) diff --git a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx index faf25679aa..a5b4d0df09 100644 --- a/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx +++ b/src/ModelingAlgorithms/TKFillet/BlendFunc/BlendFunc_EvolRad.cxx @@ -196,13 +196,12 @@ bool BlendFunc_EvolRad::ComputeValues(const math_Vector& X, const bool byParam, const double Param) { - // static declaration to avoid systematic realloc - - static gp_Vec d3u1, d3v1, d3uuv1, d3uvv1, d3u2, d3v2, d3uuv2, d3uvv2; - static gp_Vec d1gui, d2gui, d3gui; - static gp_Pnt ptgui; - static double invnormtg, dinvnormtg; - double T = Param, aux; + // Per-thread scratch, reused across calls via the t_OK / myX_OK guards below. + static thread_local gp_Vec d3u1, d3v1, d3uuv1, d3uvv1, d3u2, d3v2, d3uuv2, d3uvv2; + static thread_local gp_Vec d1gui, d2gui, d3gui; + static thread_local gp_Pnt ptgui; + static thread_local double invnormtg, dinvnormtg; + double T = Param, aux; // Case of implicit parameter if (!byParam) diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx index b4d23e9a8a..e1c8bb1d73 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_6.cxx @@ -641,7 +641,8 @@ bool ChFi3d_Builder::StoreData(occ::handle& Data, const bool Reversed) { // Small control tools. - static occ::handle checkcurve; + // Per-thread reused scratch adaptor. + static thread_local occ::handle checkcurve; if (checkcurve.IsNull()) { checkcurve = new GeomAdaptor_Curve();