From bb6e8e67b6923e9f922b2beb44e52ad499042b27 Mon Sep 17 00:00:00 2001
From: Xavier Valls <xaviervallspla@gmail.com>
Date: Tue, 7 Aug 2018 10:00:19 +0200
Subject: [PATCH] Fix IMT dependencies in TF1

---
 hist/hist/inc/TF1.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/hist/hist/inc/TF1.h b/hist/hist/inc/TF1.h
index 04b89803a8e..b648c4a7266 100644
--- a/hist/hist/inc/TF1.h
+++ b/hist/hist/inc/TF1.h
@@ -857,16 +857,9 @@ inline T TF1::GradientParTempl(Int_t ipar, const T *x, Double_t eps)
    TF1 *func = (TF1 *)this;
    Double_t *parameters = GetParameters();
 
-   // If we are in a multi-threading scenario, make this function thread-safe
-   // using a copy of the parameters vector.
-   // TODO: Check that GetImplicitMTPoolSize is the best method to check that we
-   // have more than one thread accesing the resources.
-   std::vector<Double_t> parametersCopy;
-   if (ROOT::GetImplicitMTPoolSize() != 0) {
-      parametersCopy.resize(GetNpar());
-      std::copy(parameters, parameters + GetNpar(), parametersCopy.begin());
-      parameters = parametersCopy.data();
-   }
+   // Copy parameters for thread safety
+   std::vector<Double_t> parametersCopy(parameters, parameters+GetNpar());
+   parameters = parametersCopy.data();
 
    Double_t al, bl, h2;
    T f1, f2, g1, g2, d0, d2;
-- 
GitLab