diff --git a/Installation/include/CGAL/tss.h b/Installation/include/CGAL/tss.h index 22f103e19fd..80454df9b6e 100644 --- a/Installation/include/CGAL/tss.h +++ b/Installation/include/CGAL/tss.h @@ -23,11 +23,11 @@ #ifdef CGAL_USE_BOOST_THREAD -#define CGAL_THREAD_LOCAL_DECLARE(TYPE, VAR) static boost::thread_specific_ptr VAR##_ptr +#define CGAL_THREAD_LOCAL_DECLARE(TYPE, VAR) boost::thread_specific_ptr VAR##_ptr -#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR,VAL) static boost::thread_specific_ptr VAR##_ptr +#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR,VAL) boost::thread_specific_ptr VAR##_ptr -#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) static boost::thread_specific_ptr VAR##_ptr +#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) boost::thread_specific_ptr VAR##_ptr #define CGAL_THREAD_LOCAL_IS_UNINITIALIZED(VAR) VAR##_ptr.get() == NULL @@ -54,11 +54,11 @@ -#define CGAL_THREAD_LOCAL_DECLARE(TYPE, VAR) static CGAL_THREAD_LOCAL TYPE* VAR##_ptr = NULL +#define CGAL_THREAD_LOCAL_DECLARE(TYPE, VAR) CGAL_THREAD_LOCAL TYPE* VAR##_ptr = NULL -#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR, VAL) static CGAL_THREAD_LOCAL TYPE VAR = VAL +#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR, VAL) CGAL_THREAD_LOCAL TYPE VAR = VAL -#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) static CGAL_THREAD_LOCAL TYPE VAR +#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) CGAL_THREAD_LOCAL TYPE VAR #define CGAL_THREAD_LOCAL_IS_UNINITIALIZED(VAR) VAR##_ptr == NULL @@ -87,8 +87,8 @@ #define CGAL_THREAD_LOCAL_DECLARE(TYPE, VAR) #define CGAL_THREAD_LOCAL_GET(TYPE, VAR) -#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR, VAL) static TYPE VAR = VAL -#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) static TYPE VAR; +#define CGAL_THREAD_LOCAL_DECLARE_POD(TYPE, VAR, VAL) TYPE VAR = VAL +#define CGAL_THREAD_LOCAL_DECLARE_POD2(TYPE, VAR) TYPE VAR; #define CGAL_THREAD_LOCAL_IS_UNINITIALIZED_POD(VAR) true #define CGAL_THREAD_LOCAL_SET_POD(TYPE, VAR, VAL) #define CGAL_THREAD_LOCAL_ASSIGN_POD(VAR, VAL) VAR = VAL diff --git a/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h b/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h index b759706a171..4d4d42cd1ac 100644 --- a/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h +++ b/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h @@ -64,9 +64,9 @@ private: CGAL_EXPORT static const double CST_CUT; - CGAL_EXPORT CGAL_THREAD_LOCAL_DECLARE_POD2(int, prime_int); - CGAL_EXPORT CGAL_THREAD_LOCAL_DECLARE_POD2(double, prime); - CGAL_EXPORT CGAL_THREAD_LOCAL_DECLARE_POD2(double, prime_inv); + CGAL_EXPORT static CGAL_THREAD_LOCAL_DECLARE_POD2(int, prime_int); + CGAL_EXPORT static CGAL_THREAD_LOCAL_DECLARE_POD2(double, prime); + CGAL_EXPORT static CGAL_THREAD_LOCAL_DECLARE_POD2(double, prime_inv); #if (! defined(CGAL_USE_BOOST_THREAD)) || (! defined(CGAL_HAS_THREADS)) diff --git a/Modular_arithmetic/src/CGAL/Residue_type.cpp b/Modular_arithmetic/src/CGAL/Residue_type.cpp index ab1545999b5..ac8923ef36d 100644 --- a/Modular_arithmetic/src/CGAL/Residue_type.cpp +++ b/Modular_arithmetic/src/CGAL/Residue_type.cpp @@ -21,22 +21,11 @@ #include namespace CGAL{ -#ifdef CGAL_HAS_THREADS -#ifndef CGAL_USE_BOOST_THREAD -CGAL_THREAD_LOCAL int Residue::prime_int = 67111067; -CGAL_THREAD_LOCAL double Residue::prime = 67111067.0; -CGAL_THREAD_LOCAL double Residue::prime_inv = 1490067204.5640400859667452463541; -#else -boost::thread_specific_ptr Residue::prime_int_ptr; -boost::thread_specific_ptr Residue::prime_ptr; -boost::thread_specific_ptr Residue::prime_inv_ptr; -#endif -#else -int Residue::prime_int = 67111067; -double Residue::prime = 67111067.0; -double Residue::prime_inv = 1/67111067.0; -#endif + CGAL_THREAD_LOCAL_DECLARE_POD(int, Residue::prime_int, 67111067); + CGAL_THREAD_LOCAL_DECLARE_POD(double, Residue::prime, 67111067.0); + CGAL_THREAD_LOCAL_DECLARE_POD(double, Residue::prime_inv, 1490067204.5640400859667452463541); + const double Residue::CST_CUT = std::ldexp( 3., 51 ); diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2_tls.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2_tls.h index ddacaeab38f..82fae2c6237 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2_tls.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2_tls.h @@ -1,6 +1,6 @@ - CGAL_THREAD_LOCAL_DECLARE_POD(int, maxd,30); + static CGAL_THREAD_LOCAL_DECLARE_POD(int, maxd,30); if (CGAL_THREAD_LOCAL_IS_UNINITIALIZED_POD(maxd)) { CGAL_THREAD_LOCAL_SET_POD(int, maxd,30); } @@ -8,9 +8,9 @@ # ifdef CGAL_HAS_THREADS - CGAL_THREAD_LOCAL_DECLARE(std::vector , f); - CGAL_THREAD_LOCAL_DECLARE(std::vector , i); - CGAL_THREAD_LOCAL_DECLARE(std::vector , w); + static CGAL_THREAD_LOCAL_DECLARE(std::vector , f); + static CGAL_THREAD_LOCAL_DECLARE(std::vector , i); + static CGAL_THREAD_LOCAL_DECLARE(std::vector , w); if (CGAL_THREAD_LOCAL_IS_UNINITIALIZED(f)) { CGAL_THREAD_LOCAL_SET(f, new std::vector(maxd)); CGAL_THREAD_LOCAL_SET(i, new std::vector(maxd));