Define and use CGAL_NO_ATOMIC

This commit is contained in:
Andreas Fabri 2016-09-22 15:41:53 +02:00
parent 41530c0ab4
commit 9d36d33e46
2 changed files with 7 additions and 2 deletions

View File

@ -39,7 +39,11 @@ template <class Dummy>
struct Unique_numbers {
typedef std::size_t ID;
Unique_numbers() {
#ifdef CGAL_NO_ATOMIC
static std::size_t n = 0;
#else
static CGAL::cpp11::atomic<std::size_t> n; // initialized to 0
#endif
i = n++;
}
std::size_t id() const { return i; }

View File

@ -30,7 +30,7 @@
# include <boost/atomic.hpp>
# define CGAL_ATOMIC_NS boost
# else // BOOST_VERSION < 105300
# define CGAL_NO_ATOMIC "Boost.Atomic was introduced in Boost-1.53"
# define CGAL_NO_ATOMIC "Boost.Atomic was introduced in Boost-1.53".
# endif // BOOST_VERSION < 105300
# endif // not CGAL_CAN_USE_CXX11_ATOMIC
@ -50,7 +50,8 @@
}
}
# endif // CGAL_ATOMIC_NS
#else
# define CGAL_NO_ATOMIC "No atomic because CGAL_NO_THREADS is defined."
#endif // CGAL_HAS_THREADS
#endif // CGAL_ATOMIC_H