From 9eed06477dfe366ee08fde1eb22dcd0e51a77666 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 26 Jun 2019 15:51:43 +0200 Subject: [PATCH] Use the function-local thread_local memPool, but for gcc<9.1 --- CGAL_Core/include/CGAL/CORE/MemoryPool.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/CGAL_Core/include/CGAL/CORE/MemoryPool.h b/CGAL_Core/include/CGAL/CORE/MemoryPool.h index 596613a727b..d6a49142c67 100644 --- a/CGAL_Core/include/CGAL/CORE/MemoryPool.h +++ b/CGAL_Core/include/CGAL/CORE/MemoryPool.h @@ -95,7 +95,11 @@ public: #if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100 if(memPool_ptr.get() == nullptr) {memPool_ptr.reset(new Self());} Self& memPool = * memPool_ptr.get(); -#endif +#elif defined(CGAL_HAS_THREADS) // use the C++11 implementation + static thread_local Self memPool; +#else // not CGAL_HAS_THREADS + static Self memPool; +#endif // not CGAL_HAS_THREADS return memPool; } @@ -105,10 +109,6 @@ private: #if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100 static boost::thread_specific_ptr memPool_ptr; -#elif defined(CGAL_HAS_THREADS) // use the C++11 implementation - static thread_local Self memPool; -#else // not CGAL_HAS_THREADS - static Self memPool; #endif // not CGAL_HAS_THREADS }; @@ -116,12 +116,6 @@ private: template boost::thread_specific_ptr > MemoryPool::memPool_ptr; -#else // use C++11 or without CGAL_HAS_THREADS -template -# ifdef CGAL_HAS_THREADS -thread_local -# endif -MemoryPool MemoryPool::memPool; #endif template< class T, int nObjects >