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