diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h index 3e3283e55b4..4395c25a54b 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h @@ -19,7 +19,7 @@ #include -#include +#include namespace CGAL { @@ -33,8 +33,8 @@ public: typedef bool bool_; typedef unsigned long long_; #else - typedef CGAL::cpp11::atomic bool_; - typedef CGAL::cpp11::atomic long_; + typedef std::atomic bool_; + typedef std::atomic long_; #endif static bool_ count_cases; diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h index d543e6a92a1..cf78798b185 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h @@ -19,7 +19,7 @@ #include -#include +#include #define AG2_PROFILE_PREDICATES @@ -33,7 +33,7 @@ public: #ifdef CGAL_NO_ATOMIC typedef unsigned long long_; #else - typedef CGAL::cpp11::atomic long_; + typedef std::atomic long_; #endif // high level predicates diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index 8364ffc5cd3..746ef587cac 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -23,12 +23,12 @@ * The header file for the Arr_circle_segment_traits_2 class. */ -#include #include #include #include #include +#include namespace CGAL { @@ -80,7 +80,7 @@ public: #ifdef CGAL_NO_ATOMIC static unsigned int index; #else - static CGAL::cpp11::atomic index; + static std::atomic index; #endif return (++index); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index 45c3a903ea7..4b4fea69c74 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -23,8 +23,8 @@ */ #include +#include -#include #include #include #include @@ -108,7 +108,7 @@ public: #ifdef CGAL_NO_ATOMIC static unsigned int index; #else - static CGAL::cpp11::atomic index; + static std::atomic index; #endif return (++index); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 8f07fc7be36..0ae04106cc7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -26,9 +26,9 @@ #include #include +#include #include -#include #include #include @@ -958,7 +958,7 @@ public: #ifdef CGAL_NO_ATOMIC static size_t counter; #else - static CGAL::cpp11::atomic counter; + static std::atomic counter; #endif if (doit) ++counter; return counter; diff --git a/Box_intersection_d/include/CGAL/Box_intersection_d/Box_d.h b/Box_intersection_d/include/CGAL/Box_intersection_d/Box_d.h index a6326ed6cae..ddadb14852e 100644 --- a/Box_intersection_d/include/CGAL/Box_intersection_d/Box_d.h +++ b/Box_intersection_d/include/CGAL/Box_intersection_d/Box_d.h @@ -21,10 +21,10 @@ #include #include #include -#include #include #include +#include namespace CGAL { @@ -38,7 +38,7 @@ struct Unique_numbers { #ifdef CGAL_NO_ATOMIC static std::size_t n = 0; #else - static CGAL::cpp11::atomic n; // initialized to 0 + static std::atomic n; // initialized to 0 #endif i = n++; } diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs.h b/CGAL_Core/include/CGAL/CORE/CoreDefs.h index efeb46378cb..57c3da34645 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs.h @@ -29,9 +29,10 @@ #define _CORE_COREDEFS_H_ #include -#include #include +#include + #ifdef CGAL_HEADER_ONLY #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \ @@ -75,7 +76,7 @@ namespace CORE { #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, AbortFlag, true) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, AbortFlag, true) +CGAL_GLOBAL_STATE_VAR(std::atomic, AbortFlag, true) #endif /// Invalid Flag -- initiallly value is non-negative @@ -86,7 +87,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, AbortFlag, true) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(int, InvalidFlag, 0) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, InvalidFlag, 0) +CGAL_GLOBAL_STATE_VAR(std::atomic, InvalidFlag, 0) #endif /// Escape Precision in bits @@ -102,7 +103,7 @@ CGAL_GLOBAL_STATE_VAR(long, EscapePrecFlag, 0) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, EscapePrecWarning, true) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, EscapePrecWarning, true) +CGAL_GLOBAL_STATE_VAR(std::atomic, EscapePrecWarning, true) #endif // These following two values determine the precision of computing @@ -124,7 +125,7 @@ CGAL_GLOBAL_STATE_VAR(extLong, defAbsPrec, CORE_posInfty) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(long, defBigFloatOutputDigits, 10) #else - CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defBigFloatOutputDigits, 10) + CGAL_GLOBAL_STATE_VAR(std::atomic, defBigFloatOutputDigits, 10) #endif /// default input precision in digits for converting a string to a Real or Expr @@ -138,7 +139,7 @@ CGAL_GLOBAL_STATE_VAR(extLong, defInputDigits, CORE_posInfty) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(long, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() +CGAL_GLOBAL_STATE_VAR(std::atomic, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() #endif /// default input precision in digits for converting a string to a BigFloat @@ -146,7 +147,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defOutputDigits, 10) // == get_ #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(long, defBigFloatInputDigits, 16) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defBigFloatInputDigits, 16) +CGAL_GLOBAL_STATE_VAR(std::atomic, defBigFloatInputDigits, 16) #endif inline @@ -169,7 +170,7 @@ CGAL_GLOBAL_STATE_VAR(extLong, defBFsqrtAbsPrec, 54) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, fpFilterFlag, true) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, fpFilterFlag, true) +CGAL_GLOBAL_STATE_VAR(std::atomic, fpFilterFlag, true) #endif @@ -177,7 +178,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, fpFilterFlag, true) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, incrementalEvalFlag, true) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, incrementalEvalFlag, true) +CGAL_GLOBAL_STATE_VAR(std::atomic, incrementalEvalFlag, true) #endif @@ -185,7 +186,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, incrementalEvalFlag, true) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, progressiveEvalFlag, true) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, progressiveEvalFlag, true) +CGAL_GLOBAL_STATE_VAR(std::atomic, progressiveEvalFlag, true) #endif @@ -193,14 +194,14 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, progressiveEvalFlag, true) #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(bool, rationalReduceFlag, false) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, rationalReduceFlag, false) +CGAL_GLOBAL_STATE_VAR(std::atomic, rationalReduceFlag, false) #endif /// default initial (bit) precision for AddSub Progressive Evaluation #ifdef CGAL_NO_ATOMIC CGAL_GLOBAL_STATE_VAR(long, defInitialProgressivePrec, 64) #else -CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defInitialProgressivePrec, 64) +CGAL_GLOBAL_STATE_VAR(std::atomic, defInitialProgressivePrec, 64) #endif ////////////////////////////////////////////////////////////// diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h index b7436178b0a..d28326496f3 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h @@ -24,6 +24,8 @@ #include "CGAL/CORE/CoreDefs.h" +#include + namespace CORE { // Default Values @@ -50,7 +52,7 @@ int IOErrorFlag = 0; #ifdef CGAL_NO_ATOMIC bool AbortFlag = true; #else -CGAL::cpp11::atomic AbortFlag(true); +std::atomic AbortFlag(true); #endif /** @@ -61,7 +63,7 @@ CGAL::cpp11::atomic AbortFlag(true); #ifdef CGAL_NO_ATOMIC int InvalidFlag = 0; #else -CGAL::cpp11::atomic InvalidFlag(0); +std::atomic InvalidFlag(0); #endif /* ************************************************************ @@ -97,7 +99,7 @@ long EscapePrecFlag = 0; #ifdef CGAL_NO_ATOMIC bool EscapePrecWarning = true; #else -CGAL::cpp11::atomic EscapePrecWarning(true); +std::atomic EscapePrecWarning(true); #endif /** The Composite Precision [defAbsPrec, defRelPrec] @@ -117,7 +119,7 @@ extLong defRelPrec = 60; #ifdef CGAL_NO_ATOMIC long defBigFloatOutputDigits = 10; #else -CGAL::cpp11::atomic defBigFloatOutputDigits(10); +std::atomic defBigFloatOutputDigits(10); #endif /** NORMALLY, we like to make this equal to defBigFloatOutputDigits @@ -125,7 +127,7 @@ CGAL::cpp11::atomic defBigFloatOutputDigits(10); #ifdef CGAL_NO_ATOMIC long defOutputDigits = 10; #else -CGAL::cpp11::atomic defOutputDigits(10); // == defBigFloatOutputDigits; +std::atomic defOutputDigits(10); // == defBigFloatOutputDigits; #endif /** String Input Precision */ @@ -142,7 +144,7 @@ extLong defInputDigits = CORE_posInfty; #ifdef CGAL_NO_ATOMIC long defBigFloatInputDigits = 16; #else -CGAL::cpp11::atomic defBigFloatInputDigits(16); +std::atomic defBigFloatInputDigits(16); #endif /* ************************************************************ @@ -154,7 +156,7 @@ CGAL::cpp11::atomic defBigFloatInputDigits(16); #ifdef CGAL_NO_ATOMIC bool fpFilterFlag = true; #else -CGAL::cpp11::atomic fpFilterFlag(true); +std::atomic fpFilterFlag(true); #endif /** IncrementaL evaluation flag @@ -163,7 +165,7 @@ CGAL::cpp11::atomic fpFilterFlag(true); #ifdef CGAL_NO_ATOMIC bool incrementalEvalFlag = true; #else -CGAL::cpp11::atomic incrementalEvalFlag(true); +std::atomic incrementalEvalFlag(true); #endif /** Progressive evaluation flag @@ -171,7 +173,7 @@ CGAL::cpp11::atomic incrementalEvalFlag(true); #ifdef CGAL_NO_ATOMIC bool progressiveEvalFlag = true; #else -CGAL::cpp11::atomic progressiveEvalFlag(true); +std::atomic progressiveEvalFlag(true); #endif /** Initial progressive evaluation precision @@ -179,7 +181,7 @@ CGAL::cpp11::atomic progressiveEvalFlag(true); #ifdef CGAL_NO_ATOMIC long defInitialProgressivePrec = 64; #else -CGAL::cpp11::atomic defInitialProgressivePrec(64); +std::atomic defInitialProgressivePrec(64); #endif /** RATIONAL REDUCTION FLAG @@ -187,7 +189,7 @@ CGAL::cpp11::atomic defInitialProgressivePrec(64); #ifdef CGAL_NO_ATOMIC bool rationalReduceFlag = false; #else -CGAL::cpp11::atomic rationalReduceFlag(false); +std::atomic rationalReduceFlag(false); #endif #endif // CGAL_HEADER_ONLY diff --git a/Installation/include/CGAL/atomic.h b/Installation/include/CGAL/atomic.h index 5c92b46fd2a..da0a5c1c0a2 100644 --- a/Installation/include/CGAL/atomic.h +++ b/Installation/include/CGAL/atomic.h @@ -10,6 +10,9 @@ #ifndef CGAL_ATOMIC_H #define CGAL_ATOMIC_H +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" + #include #ifdef CGAL_HAS_THREADS diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 044dad499a0..037042875aa 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -623,6 +623,9 @@ using std::max; # include # include # include +# include +# include +# include // namespace CGAL { // @@ -641,6 +644,16 @@ namespace CGAL { using std::is_enum; using std::unordered_set; using std::unordered_map; + using std::atomic; + using std::memory_order_relaxed; + using std::memory_order_consume; + using std::memory_order_acquire; + using std::memory_order_release; + using std::memory_order_acq_rel; + using std::memory_order_seq_cst; + using std::atomic_thread_fence; + using std::thread; + } // namespace cpp0x = cpp11; diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 0d81d7a8455..de889e42acf 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -45,7 +45,6 @@ #include #include #include -#include #ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE #include @@ -65,6 +64,7 @@ #include #include #include +#include namespace CGAL { namespace Mesh_3 { @@ -222,7 +222,7 @@ public: std::size_t maximal_number_of_vertices = 0, Mesh_error_code* error_code = 0 #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr = 0 + , std::atomic* stop_ptr = 0 #endif ); @@ -294,7 +294,7 @@ private: #ifndef CGAL_NO_ATOMIC /// Pointer to the atomic Boolean that can stop the process - CGAL::cpp11::atomic* const stop_ptr; + std::atomic* const stop_ptr; #endif #ifdef CGAL_LINKED_WITH_TBB @@ -318,7 +318,7 @@ private: bool forced_stop() const { #ifndef CGAL_NO_ATOMIC if(stop_ptr != 0 && - stop_ptr->load(CGAL::cpp11::memory_order_acquire) == true) + stop_ptr->load(std::memory_order_acquire) == true) { if(error_code_ != 0) *error_code_ = CGAL_MESH_3_STOPPED; return true; @@ -353,7 +353,7 @@ Mesher_3::Mesher_3(C3T3& c3t3, std::size_t maximal_number_of_vertices, Mesh_error_code* error_code #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : Base(c3t3.bbox(), diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h index b0b7c00229c..b0c7e357c96 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h @@ -23,7 +23,6 @@ #include #endif -#include #include #ifdef CGAL_CONCURRENT_MESH_3_PROFILING @@ -37,7 +36,7 @@ # include #endif -#include +#include namespace CGAL { namespace Mesh_3 { @@ -677,7 +676,7 @@ public: void set_lock_ds(Lock_data_structure *) {} void set_worksharing_ds(WorksharingDataStructureType *) {} #ifndef CGAL_NO_ATOMIC - void set_stop_pointer(CGAL::cpp11::atomic*) {} + void set_stop_pointer(std::atomic*) {} #endif protected: @@ -1147,7 +1146,7 @@ public: } #ifndef CGAL_NO_ATOMIC - void set_stop_pointer(CGAL::cpp11::atomic* stop_ptr) + void set_stop_pointer(std::atomic* stop_ptr) { m_stop_ptr = stop_ptr; } @@ -1156,7 +1155,7 @@ public: bool forced_stop() const { #ifndef CGAL_NO_ATOMIC if(m_stop_ptr != 0 && - m_stop_ptr->load(CGAL::cpp11::memory_order_acquire) == true) + m_stop_ptr->load(std::memory_order_acquire) == true) { CGAL_assertion(m_task_group != 0); m_task_group->cancel(); @@ -1177,7 +1176,7 @@ protected: tbb::task_group *m_task_group; #ifndef CGAL_NO_ATOMIC - CGAL::cpp11::atomic* m_stop_ptr; + std::atomic* m_stop_ptr; #endif private: diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index e0328dab5d2..36a48742614 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -46,7 +46,6 @@ #include #include #include -#include #include @@ -70,6 +69,7 @@ #include #include #include +#include namespace CGAL { namespace Mesh_3 { @@ -143,7 +143,7 @@ public: std::size_t maximal_number_of_vertices = 0, Mesh_error_code* error_code = 0 #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr = 0 + , std::atomic* stop_ptr = 0 #endif ); @@ -156,7 +156,7 @@ public: bool forced_stop() const { #ifndef CGAL_NO_ATOMIC if(stop_ptr_ != 0 && - stop_ptr_->load(CGAL::cpp11::memory_order_acquire) == true) + stop_ptr_->load(std::memory_order_acquire) == true) { if(error_code_ != 0) *error_code_ = CGAL_MESH_3_STOPPED; return true; @@ -469,7 +469,7 @@ private: Mesh_error_code* const error_code_; #ifndef CGAL_NO_ATOMIC /// Pointer to the atomic Boolean that can stop the process - CGAL::cpp11::atomic* const stop_ptr_; + std::atomic* const stop_ptr_; #endif }; @@ -481,7 +481,7 @@ Protect_edges_sizing_field(C3T3& c3t3, const MD& domain, std::size_t maximal_number_of_vertices, Mesh_error_code* error_code #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : c3t3_(c3t3) diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h index 7392d5667a9..f3d1e0ba7fa 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h @@ -26,7 +26,6 @@ #include #include #endif -#include #include #include @@ -41,7 +40,7 @@ #include #include #include - +#include namespace CGAL { @@ -319,7 +318,7 @@ public: C3T3& c3t3, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ); // For parallel @@ -332,7 +331,7 @@ public: WorksharingDataStructureType *worksharing_ds, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ); @@ -372,7 +371,7 @@ public: { #ifndef CGAL_NO_ATOMIC if(m_stop_ptr != 0 && - m_stop_ptr->load(CGAL::cpp11::memory_order_acquire) == true) + m_stop_ptr->load(std::memory_order_acquire) == true) { return true; } @@ -573,7 +572,7 @@ private: #ifndef CGAL_NO_ATOMIC /// Pointer to the atomic Boolean that can stop the process - CGAL::cpp11::atomic* const m_stop_ptr; + std::atomic* const m_stop_ptr; #endif private: // Disabled copy constructor @@ -595,7 +594,7 @@ Refine_cells_3(Tr& triangulation, C3T3& c3t3, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : Mesher_level* stop_ptr + , std::atomic* stop_ptr #endif ) : Mesher_level #include -#include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include namespace CGAL { @@ -255,7 +255,7 @@ public: const Criteria& criteria, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : r_tr_(tr) @@ -275,7 +275,7 @@ public: { #ifndef CGAL_NO_ATOMIC if(m_stop_ptr != 0 && - m_stop_ptr->load(CGAL::cpp11::memory_order_acquire) == true) + m_stop_ptr->load(std::memory_order_acquire) == true) { return true; } @@ -615,7 +615,7 @@ protected: std::size_t m_maximal_number_of_vertices_; #ifndef CGAL_NO_ATOMIC /// Pointer to the atomic Boolean that can stop the process - CGAL::cpp11::atomic* const m_stop_ptr; + std::atomic* const m_stop_ptr; #endif }; // end class template Refine_facets_3_base @@ -783,7 +783,7 @@ public: int mesh_topology, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ); // For parallel @@ -796,7 +796,7 @@ public: WorksharingDataStructureType *worksharing_ds, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ); @@ -916,7 +916,7 @@ Refine_facets_3(Tr& triangulation, int mesh_topology, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : Rf_base(triangulation, c3t3, oracle, criteria, mesh_topology, @@ -945,7 +945,7 @@ Refine_facets_3(Tr& triangulation, WorksharingDataStructureType *worksharing_ds, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : Rf_base(triangulation, c3t3, oracle, criteria, maximal_number_of_vertices diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h index 3038ce6383f..17b04cc4239 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_manifold_base.h @@ -19,7 +19,6 @@ #include -#include #include #include @@ -31,6 +30,7 @@ #include #include +#include namespace CGAL { @@ -308,7 +308,7 @@ public: int mesh_topology, std::size_t maximal_number_of_vertices #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* stop_ptr + , std::atomic* stop_ptr #endif ) : Base(triangulation, @@ -446,7 +446,7 @@ public: #ifndef CGAL_NO_ATOMIC if(this->m_stop_ptr != 0 && - this->m_stop_ptr->load(CGAL::cpp11::memory_order_acquire) == true) + this->m_stop_ptr->load(std::memory_order_acquire) == true) { return true; } diff --git a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h index ddda978ed2c..91f0ab6f07e 100644 --- a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace CGAL { @@ -65,6 +66,13 @@ template <> class Mesh_vertex_base_3_base { public: + Mesh_vertex_base_3_base() + {} + + Mesh_vertex_base_3_base( const Mesh_vertex_base_3_base& c) + { + m_erase_counter.store(c.erase_counter()); + } // Erase counter (cf. Compact_container) unsigned int erase_counter() const @@ -81,7 +89,7 @@ public: } protected: - typedef tbb::atomic Erase_counter_type; + typedef std::atomic Erase_counter_type; Erase_counter_type m_erase_counter; }; diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 6bc7be6c596..a75e120da69 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -32,6 +32,8 @@ #include #include +#include + namespace CGAL { namespace parameters { @@ -192,7 +194,7 @@ void init_c3t3_with_features(C3T3& c3t3, std::size_t maximal_number_of_vertices = 0, Mesh_error_code* pointer_to_error_code = 0 #ifndef CGAL_NO_ATOMIC - , CGAL::cpp11::atomic* pointer_to_stop = 0 + , std::atomic* pointer_to_stop = 0 #endif ) { diff --git a/Mesh_3/include/CGAL/refine_mesh_3.h b/Mesh_3/include/CGAL/refine_mesh_3.h index bba8c6c199e..acbf847b26b 100644 --- a/Mesh_3/include/CGAL/refine_mesh_3.h +++ b/Mesh_3/include/CGAL/refine_mesh_3.h @@ -28,10 +28,11 @@ #include #include #include -#include #include +#include + namespace CGAL { namespace details { @@ -196,7 +197,7 @@ struct Manifold_options { // Various Mesh_3 option struct Mesh_3_options { #ifndef CGAL_NO_ATOMIC - typedef CGAL::cpp11::atomic* Pointer_to_stop_atomic_boolean_t; + typedef std::atomic* Pointer_to_stop_atomic_boolean_t; #else typedef bool* Pointer_to_stop_atomic_boolean_t; #endif diff --git a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h index 2bee2a582e5..80fb7487800 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h @@ -15,9 +15,6 @@ #include - -#include - #include #include #include @@ -26,6 +23,8 @@ #include #include +#include + #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 83 #include @@ -42,7 +41,7 @@ class Index_generator { #ifdef CGAL_NO_ATOMIC static int unique; #else - static CGAL::cpp11::atomic unique; + static std::atomic unique; #endif return unique++; } diff --git a/Number_types/include/CGAL/Counted_number.h b/Number_types/include/CGAL/Counted_number.h index 7f6dfcf04c1..bb3dc060f0e 100644 --- a/Number_types/include/CGAL/Counted_number.h +++ b/Number_types/include/CGAL/Counted_number.h @@ -19,9 +19,9 @@ #define CGAL_COUNTED_NUMBER_H #include -#include #include // for Root_of_selector #include +#include namespace CGAL { @@ -30,7 +30,7 @@ class Counted_number { #ifdef CGAL_NO_ATOMIC static unsigned long #else - static CGAL::cpp11::atomic + static std::atomic #endif s_neg_count, s_add_count, s_sub_count, s_mul_count, s_div_count, @@ -280,64 +280,64 @@ template< class NT > unsigned long Counted_number::s_mod_count = 0; #else template -CGAL::cpp11::atomic Counted_number::s_neg_count; +std::atomic Counted_number::s_neg_count; template -CGAL::cpp11::atomic Counted_number::s_add_count; +std::atomic Counted_number::s_add_count; template -CGAL::cpp11::atomic Counted_number::s_sub_count; +std::atomic Counted_number::s_sub_count; template -CGAL::cpp11::atomic Counted_number::s_mul_count; +std::atomic Counted_number::s_mul_count; template -CGAL::cpp11::atomic Counted_number::s_div_count; +std::atomic Counted_number::s_div_count; template -CGAL::cpp11::atomic Counted_number::s_eq_count; +std::atomic Counted_number::s_eq_count; template -CGAL::cpp11::atomic Counted_number::s_comp_count; +std::atomic Counted_number::s_comp_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_simplify_count; +std::atomic Counted_number::s_simplify_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_unit_part_count; +std::atomic Counted_number::s_unit_part_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_is_zero_count; +std::atomic Counted_number::s_is_zero_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_is_one_count; +std::atomic Counted_number::s_is_one_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_square_count; +std::atomic Counted_number::s_square_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_integral_division_count; +std::atomic Counted_number::s_integral_division_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_is_square_count; +std::atomic Counted_number::s_is_square_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_sqrt_count; +std::atomic Counted_number::s_sqrt_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_kth_root_count; +std::atomic Counted_number::s_kth_root_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_root_of_count; +std::atomic Counted_number::s_root_of_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_gcd_count; +std::atomic Counted_number::s_gcd_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_div_mod_count; +std::atomic Counted_number::s_div_mod_count; template< class NT > -CGAL::cpp11::atomic Counted_number::s_mod_count; +std::atomic Counted_number::s_mod_count; #endif diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Callback_wrapper.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Callback_wrapper.h index c52826db44b..229eae5897a 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Callback_wrapper.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Callback_wrapper.h @@ -13,10 +13,10 @@ #define CGAL_PSP_INTERNAL_CALLBACK_WRAPPER_H #include - +#include +#include #include -#include namespace CGAL { namespace Point_set_processing_3 { @@ -91,11 +91,11 @@ template <> class Callback_wrapper { const std::function& m_callback; - cpp11::atomic* m_advancement; - cpp11::atomic* m_interrupted; + std::atomic* m_advancement; + std::atomic* m_interrupted; std::size_t m_size; bool m_creator; - cpp11::thread* m_thread; + std::thread* m_thread; // assignment operator shouldn't be used (m_callback is const ref) Callback_wrapper& operator= (const Callback_wrapper&) @@ -109,17 +109,17 @@ public: std::size_t advancement = 0, bool interrupted = false) : m_callback (callback) - , m_advancement (new cpp11::atomic()) - , m_interrupted (new cpp11::atomic()) + , m_advancement (new std::atomic()) + , m_interrupted (new std::atomic()) , m_size (size) , m_creator (true) , m_thread (nullptr) { - // cpp11::atomic only has default constructor, initialization done in two steps + // std::atomic only has default constructor, initialization done in two steps *m_advancement = advancement; *m_interrupted = interrupted; if (m_callback) - m_thread = new cpp11::thread (*this); + m_thread = new std::thread (*this); } Callback_wrapper (const Callback_wrapper& other) @@ -150,11 +150,11 @@ public: *m_advancement = advancement; *m_interrupted = interrupted; if (m_callback) - m_thread = new cpp11::thread (*this); + m_thread = new std::thread (*this); } - cpp11::atomic& advancement() { return *m_advancement; } - cpp11::atomic& interrupted() { return *m_interrupted; } + std::atomic& advancement() { return *m_advancement; } + std::atomic& interrupted() { return *m_interrupted; } void join() { if (m_thread != nullptr) @@ -169,7 +169,9 @@ public: *m_interrupted = true; if (*m_interrupted) return; - cpp11::sleep_for (0.00001); + typedef std::chrono::nanoseconds nanoseconds; + nanoseconds ns (nanoseconds::rep (1000000000.0 * 0.00001)); + std::this_thread::sleep_for(ns); } if (m_callback) m_callback (1.); diff --git a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h index 47f5f9670df..f2657fda3f1 100644 --- a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h +++ b/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h @@ -3,10 +3,11 @@ #include #include -#include #include "Callback_signaler.h" +#include + typedef CGAL::Parallel_if_available_tag Concurrency_tag; class Signal_callback @@ -112,12 +113,14 @@ void run_with_qprogressdialog (Functor& functor, #ifdef CGAL_HAS_STD_THREADS if (boost::is_convertible::value) { - CGAL::cpp11::thread thread (functor); + std::thread thread (functor); while (*signal_callback->latest_adv != 1. && *signal_callback->state) { - CGAL::cpp11::sleep_for (0.1); + typedef std::chrono::nanoseconds nanoseconds; + nanoseconds ns (nanoseconds::rep (1000000000.0 * 0.1)); + std::this_thread::sleep_for(ns); QApplication::processEvents (); } diff --git a/Profiling_tools/include/CGAL/Profile_counter.h b/Profiling_tools/include/CGAL/Profile_counter.h index dfaacdb48f9..537d7640bee 100644 --- a/Profiling_tools/include/CGAL/Profile_counter.h +++ b/Profiling_tools/include/CGAL/Profile_counter.h @@ -48,6 +48,7 @@ #include #include #include +#include #include @@ -92,7 +93,7 @@ struct Profile_counter Profile_counter(const std::string & ss) : s(ss) { - i = 0; // needed here because of tbb::atomic + i = 0; // needed here because of std::atomic } void operator++() { ++i; } @@ -107,7 +108,7 @@ struct Profile_counter private: #ifdef CGAL_CONCURRENT_PROFILE - tbb::atomic i; + std::atomic i; #else unsigned int i; #endif @@ -167,7 +168,7 @@ struct Profile_branch_counter Profile_branch_counter(const std::string & ss) : s(ss) { - i = j = 0; // needed here because of tbb::atomic + i = j = 0; // needed here because of std::atomic } void operator++() { ++i; } @@ -183,7 +184,7 @@ struct Profile_branch_counter private: #ifdef CGAL_CONCURRENT_PROFILE - tbb::atomic i, j; + std::atomic i, j; #else unsigned int i, j; #endif @@ -196,7 +197,7 @@ struct Profile_branch_counter_3 Profile_branch_counter_3(const std::string & ss) : s(ss) { - i = j = k = 0; // needed here because of tbb::atomic + i = j = k = 0; // needed here because of std::atomic } void operator++() { ++i; } @@ -214,7 +215,7 @@ struct Profile_branch_counter_3 private: #ifdef CGAL_CONCURRENT_PROFILE - tbb::atomic i, j, k; + std::atomic i, j, k; #else unsigned int i, j, k; #endif diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 3877e39f98b..d1f1a4e840f 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/STL_Extension/include/CGAL/Time_stamper.h b/STL_Extension/include/CGAL/Time_stamper.h index f0cfe44a574..8d346516a27 100644 --- a/STL_Extension/include/CGAL/Time_stamper.h +++ b/STL_Extension/include/CGAL/Time_stamper.h @@ -13,7 +13,6 @@ #define CGAL_TIME_STAMPER_H #include -#include namespace CGAL { diff --git a/STL_Extension/include/CGAL/thread.h b/STL_Extension/include/CGAL/thread.h index fb5a7ca1310..7d163964cf7 100644 --- a/STL_Extension/include/CGAL/thread.h +++ b/STL_Extension/include/CGAL/thread.h @@ -12,6 +12,9 @@ #ifndef CGAL_THREAD_H #define CGAL_THREAD_H +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" + #include /*