From 4710e1f93dacca4898d6a3f69e4e36ed34c51b0f Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 23 Jul 2018 15:44:05 +0200 Subject: [PATCH] Fix the conflict between and Before this commit, they were both defining `CGAL::cpp11::atomic`. Now, `` includes ``, and it only defined `CGAL::cpp11::atomic`, using the TBB implementation, if `CGAL_NO_ATOMIC` was defined by ``. @sgiraudot Please have a look. --- STL_Extension/include/CGAL/thread.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/STL_Extension/include/CGAL/thread.h b/STL_Extension/include/CGAL/thread.h index a777d7e7286..737105e1a8b 100644 --- a/STL_Extension/include/CGAL/thread.h +++ b/STL_Extension/include/CGAL/thread.h @@ -55,10 +55,11 @@ #if !CGAL_USE_TBB_THREADS # include -# include # include #endif +#include // for CGAL::cpp11::atomic + namespace CGAL { namespace cpp11 { @@ -66,7 +67,6 @@ namespace cpp11 { #if CGAL_USE_TBB_THREADS using std::thread; // std::thread is declared by TBB if TBB_IMPLEMENT_CPP0X == 1 - using tbb::atomic; inline void sleep_for (double seconds) { @@ -75,10 +75,9 @@ namespace cpp11 { std::this_thread::sleep_for(tbb::tick_count::interval_t(seconds)); } -#else +#else // C++11 implementation using std::thread; - using std::atomic; inline void sleep_for (double seconds) { @@ -91,6 +90,12 @@ namespace cpp11 { #endif +#if defined(CGAL_NO_ATOMIC) && defined(CGAL_LINKED_WITH_TBB) + // If did not defined CGAL::cpp11::atomic, then use + // tbb::atomic as a fallback. + using tbb::atomic; +#endif + } // cpp11