mirror of https://github.com/CGAL/cgal
Fix the conflict between <CGAL/atomic.h> and <CGAL/thread.h>
Before this commit, they were both defining `CGAL::cpp11::atomic`. Now, `<CGAL/thread.h>` includes `<CGAL/atomic.h>`, and it only defined `CGAL::cpp11::atomic`, using the TBB implementation, if `CGAL_NO_ATOMIC` was defined by `<CGAL/atomic.h>`. @sgiraudot Please have a look.
This commit is contained in:
parent
ae1e1439cf
commit
4710e1f93d
|
|
@ -55,10 +55,11 @@
|
|||
|
||||
#if !CGAL_USE_TBB_THREADS
|
||||
# include <thread>
|
||||
# include <atomic>
|
||||
# include <chrono>
|
||||
#endif
|
||||
|
||||
#include <CGAL/atomic.h> // 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 <CGAL/atomic.h> did not defined CGAL::cpp11::atomic, then use
|
||||
// tbb::atomic as a fallback.
|
||||
using tbb::atomic;
|
||||
#endif
|
||||
|
||||
} // cpp11
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue