Merge pull request #5692 from maxGimeno/CGAL_cpp11_atomic_and_threads-maxGimeno

CGAL:: Use std atomic and threads

# Conflicts:
#	Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h
This commit is contained in:
Laurent Rineau 2021-05-19 17:11:37 +02:00
commit 82bec8a1d6
27 changed files with 159 additions and 125 deletions

View File

@ -19,7 +19,7 @@
#include <CGAL/Apollonius_graph_2/basic.h> #include <CGAL/Apollonius_graph_2/basic.h>
#include <CGAL/atomic.h> #include <atomic>
namespace CGAL { namespace CGAL {
@ -33,8 +33,8 @@ public:
typedef bool bool_; typedef bool bool_;
typedef unsigned long long_; typedef unsigned long long_;
#else #else
typedef CGAL::cpp11::atomic<bool> bool_; typedef std::atomic<bool> bool_;
typedef CGAL::cpp11::atomic<unsigned long> long_; typedef std::atomic<unsigned long> long_;
#endif #endif
static bool_ count_cases; static bool_ count_cases;

View File

@ -19,7 +19,7 @@
#include <CGAL/Apollonius_graph_2/basic.h> #include <CGAL/Apollonius_graph_2/basic.h>
#include <CGAL/atomic.h> #include <atomic>
#define AG2_PROFILE_PREDICATES #define AG2_PROFILE_PREDICATES
@ -33,7 +33,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
typedef unsigned long long_; typedef unsigned long long_;
#else #else
typedef CGAL::cpp11::atomic<unsigned long> long_; typedef std::atomic<unsigned long> long_;
#endif #endif
// high level predicates // high level predicates

View File

@ -23,12 +23,12 @@
* The header file for the Arr_circle_segment_traits_2<Kenrel> class. * The header file for the Arr_circle_segment_traits_2<Kenrel> class.
*/ */
#include <CGAL/atomic.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
#include <CGAL/Arr_geometry_traits/Circle_segment_2.h> #include <CGAL/Arr_geometry_traits/Circle_segment_2.h>
#include <fstream> #include <fstream>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -80,7 +80,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static unsigned int index; static unsigned int index;
#else #else
static CGAL::cpp11::atomic<unsigned int> index; static std::atomic<unsigned int> index;
#endif #endif
return (++index); return (++index);
} }

View File

@ -23,8 +23,8 @@
*/ */
#include <fstream> #include <fstream>
#include <atomic>
#include <CGAL/atomic.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
#include <CGAL/Arr_geometry_traits/Conic_arc_2.h> #include <CGAL/Arr_geometry_traits/Conic_arc_2.h>
@ -108,7 +108,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static unsigned int index; static unsigned int index;
#else #else
static CGAL::cpp11::atomic<unsigned int> index; static std::atomic<unsigned int> index;
#endif #endif
return (++index); return (++index);
} }

View File

@ -26,9 +26,9 @@
#include <iostream> #include <iostream>
#include <string.h> #include <string.h>
#include <atomic>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/atomic.h>
#include <CGAL/Arr_enums.h> #include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
@ -958,7 +958,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static size_t counter; static size_t counter;
#else #else
static CGAL::cpp11::atomic<size_t> counter; static std::atomic<size_t> counter;
#endif #endif
if (doit) ++counter; if (doit) ++counter;
return counter; return counter;

View File

@ -21,10 +21,10 @@
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
#include <CGAL/Box_intersection_d/box_limits.h> #include <CGAL/Box_intersection_d/box_limits.h>
#include <CGAL/atomic.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -38,7 +38,7 @@ struct Unique_numbers {
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static std::size_t n = 0; static std::size_t n = 0;
#else #else
static CGAL::cpp11::atomic<std::size_t> n; // initialized to 0 static std::atomic<std::size_t> n; // initialized to 0
#endif #endif
i = n++; i = n++;
} }

View File

@ -29,9 +29,10 @@
#define _CORE_COREDEFS_H_ #define _CORE_COREDEFS_H_
#include <CGAL/CORE/extLong.h> #include <CGAL/CORE/extLong.h>
#include <CGAL/atomic.h>
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
#include <atomic>
#ifdef CGAL_HEADER_ONLY #ifdef CGAL_HEADER_ONLY
#define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \ #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \
@ -75,7 +76,7 @@ namespace CORE {
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, AbortFlag, true) CGAL_GLOBAL_STATE_VAR(bool, AbortFlag, true)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, AbortFlag, true) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, AbortFlag, true)
#endif #endif
/// Invalid Flag -- initiallly value is non-negative /// Invalid Flag -- initiallly value is non-negative
@ -86,7 +87,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, AbortFlag, true)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(int, InvalidFlag, 0) CGAL_GLOBAL_STATE_VAR(int, InvalidFlag, 0)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<int>, InvalidFlag, 0) CGAL_GLOBAL_STATE_VAR(std::atomic<int>, InvalidFlag, 0)
#endif #endif
/// Escape Precision in bits /// Escape Precision in bits
@ -102,7 +103,7 @@ CGAL_GLOBAL_STATE_VAR(long, EscapePrecFlag, 0)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, EscapePrecWarning, true) CGAL_GLOBAL_STATE_VAR(bool, EscapePrecWarning, true)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, EscapePrecWarning, true) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, EscapePrecWarning, true)
#endif #endif
// These following two values determine the precision of computing // 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 #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(long, defBigFloatOutputDigits, 10) CGAL_GLOBAL_STATE_VAR(long, defBigFloatOutputDigits, 10)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<long>, defBigFloatOutputDigits, 10) CGAL_GLOBAL_STATE_VAR(std::atomic<long>, defBigFloatOutputDigits, 10)
#endif #endif
/// default input precision in digits for converting a string to a Real or Expr /// 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 #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(long, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() CGAL_GLOBAL_STATE_VAR(long, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits()
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<long>, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() CGAL_GLOBAL_STATE_VAR(std::atomic<long>, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits()
#endif #endif
/// default input precision in digits for converting a string to a BigFloat /// default input precision in digits for converting a string to a BigFloat
@ -146,7 +147,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<long>, defOutputDigits, 10) // == get_
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(long, defBigFloatInputDigits, 16) CGAL_GLOBAL_STATE_VAR(long, defBigFloatInputDigits, 16)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<long>, defBigFloatInputDigits, 16) CGAL_GLOBAL_STATE_VAR(std::atomic<long>, defBigFloatInputDigits, 16)
#endif #endif
inline inline
@ -169,7 +170,7 @@ CGAL_GLOBAL_STATE_VAR(extLong, defBFsqrtAbsPrec, 54)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, fpFilterFlag, true) CGAL_GLOBAL_STATE_VAR(bool, fpFilterFlag, true)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, fpFilterFlag, true) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, fpFilterFlag, true)
#endif #endif
@ -177,7 +178,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, fpFilterFlag, true)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, incrementalEvalFlag, true) CGAL_GLOBAL_STATE_VAR(bool, incrementalEvalFlag, true)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, incrementalEvalFlag, true) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, incrementalEvalFlag, true)
#endif #endif
@ -185,7 +186,7 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, incrementalEvalFlag, true)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, progressiveEvalFlag, true) CGAL_GLOBAL_STATE_VAR(bool, progressiveEvalFlag, true)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, progressiveEvalFlag, true) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, progressiveEvalFlag, true)
#endif #endif
@ -193,14 +194,14 @@ CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, progressiveEvalFlag, true)
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(bool, rationalReduceFlag, false) CGAL_GLOBAL_STATE_VAR(bool, rationalReduceFlag, false)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<bool>, rationalReduceFlag, false) CGAL_GLOBAL_STATE_VAR(std::atomic<bool>, rationalReduceFlag, false)
#endif #endif
/// default initial (bit) precision for AddSub Progressive Evaluation /// default initial (bit) precision for AddSub Progressive Evaluation
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
CGAL_GLOBAL_STATE_VAR(long, defInitialProgressivePrec, 64) CGAL_GLOBAL_STATE_VAR(long, defInitialProgressivePrec, 64)
#else #else
CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic<long>, defInitialProgressivePrec, 64) CGAL_GLOBAL_STATE_VAR(std::atomic<long>, defInitialProgressivePrec, 64)
#endif #endif
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////

View File

@ -24,6 +24,8 @@
#include "CGAL/CORE/CoreDefs.h" #include "CGAL/CORE/CoreDefs.h"
#include <atomic>
namespace CORE { namespace CORE {
// Default Values // Default Values
@ -50,7 +52,7 @@ int IOErrorFlag = 0;
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool AbortFlag = true; bool AbortFlag = true;
#else #else
CGAL::cpp11::atomic<bool> AbortFlag(true); std::atomic<bool> AbortFlag(true);
#endif #endif
/** /**
@ -61,7 +63,7 @@ CGAL::cpp11::atomic<bool> AbortFlag(true);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
int InvalidFlag = 0; int InvalidFlag = 0;
#else #else
CGAL::cpp11::atomic<int> InvalidFlag(0); std::atomic<int> InvalidFlag(0);
#endif #endif
/* ************************************************************ /* ************************************************************
@ -97,7 +99,7 @@ long EscapePrecFlag = 0;
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool EscapePrecWarning = true; bool EscapePrecWarning = true;
#else #else
CGAL::cpp11::atomic<bool> EscapePrecWarning(true); std::atomic<bool> EscapePrecWarning(true);
#endif #endif
/** The Composite Precision [defAbsPrec, defRelPrec] /** The Composite Precision [defAbsPrec, defRelPrec]
@ -117,7 +119,7 @@ extLong defRelPrec = 60;
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
long defBigFloatOutputDigits = 10; long defBigFloatOutputDigits = 10;
#else #else
CGAL::cpp11::atomic<long> defBigFloatOutputDigits(10); std::atomic<long> defBigFloatOutputDigits(10);
#endif #endif
/** NORMALLY, we like to make this equal to defBigFloatOutputDigits /** NORMALLY, we like to make this equal to defBigFloatOutputDigits
@ -125,7 +127,7 @@ CGAL::cpp11::atomic<long> defBigFloatOutputDigits(10);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
long defOutputDigits = 10; long defOutputDigits = 10;
#else #else
CGAL::cpp11::atomic<long> defOutputDigits(10); // == defBigFloatOutputDigits; std::atomic<long> defOutputDigits(10); // == defBigFloatOutputDigits;
#endif #endif
/** String Input Precision */ /** String Input Precision */
@ -142,7 +144,7 @@ extLong defInputDigits = CORE_posInfty;
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
long defBigFloatInputDigits = 16; long defBigFloatInputDigits = 16;
#else #else
CGAL::cpp11::atomic<long> defBigFloatInputDigits(16); std::atomic<long> defBigFloatInputDigits(16);
#endif #endif
/* ************************************************************ /* ************************************************************
@ -154,7 +156,7 @@ CGAL::cpp11::atomic<long> defBigFloatInputDigits(16);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool fpFilterFlag = true; bool fpFilterFlag = true;
#else #else
CGAL::cpp11::atomic<bool> fpFilterFlag(true); std::atomic<bool> fpFilterFlag(true);
#endif #endif
/** IncrementaL evaluation flag /** IncrementaL evaluation flag
@ -163,7 +165,7 @@ CGAL::cpp11::atomic<bool> fpFilterFlag(true);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool incrementalEvalFlag = true; bool incrementalEvalFlag = true;
#else #else
CGAL::cpp11::atomic<bool> incrementalEvalFlag(true); std::atomic<bool> incrementalEvalFlag(true);
#endif #endif
/** Progressive evaluation flag /** Progressive evaluation flag
@ -171,7 +173,7 @@ CGAL::cpp11::atomic<bool> incrementalEvalFlag(true);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool progressiveEvalFlag = true; bool progressiveEvalFlag = true;
#else #else
CGAL::cpp11::atomic<bool> progressiveEvalFlag(true); std::atomic<bool> progressiveEvalFlag(true);
#endif #endif
/** Initial progressive evaluation precision /** Initial progressive evaluation precision
@ -179,7 +181,7 @@ CGAL::cpp11::atomic<bool> progressiveEvalFlag(true);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
long defInitialProgressivePrec = 64; long defInitialProgressivePrec = 64;
#else #else
CGAL::cpp11::atomic<long> defInitialProgressivePrec(64); std::atomic<long> defInitialProgressivePrec(64);
#endif #endif
/** RATIONAL REDUCTION FLAG /** RATIONAL REDUCTION FLAG
@ -187,7 +189,7 @@ CGAL::cpp11::atomic<long> defInitialProgressivePrec(64);
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
bool rationalReduceFlag = false; bool rationalReduceFlag = false;
#else #else
CGAL::cpp11::atomic<bool> rationalReduceFlag(false); std::atomic<bool> rationalReduceFlag(false);
#endif #endif
#endif // CGAL_HEADER_ONLY #endif // CGAL_HEADER_ONLY

View File

@ -10,6 +10,9 @@
#ifndef CGAL_ATOMIC_H #ifndef CGAL_ATOMIC_H
#define CGAL_ATOMIC_H #define CGAL_ATOMIC_H
#define CGAL_DEPRECATED_HEADER "<CGAL/atomic.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/config.h>"
#include <CGAL/config.h> #include <CGAL/config.h>
#ifdef CGAL_HAS_THREADS #ifdef CGAL_HAS_THREADS

View File

@ -646,6 +646,9 @@ using std::max;
# include <unordered_set> # include <unordered_set>
# include <unordered_map> # include <unordered_map>
# include <functional> # include <functional>
# include <thread>
# include <chrono>
# include <atomic>
// //
namespace CGAL { namespace CGAL {
// //
@ -664,6 +667,16 @@ namespace CGAL {
using std::is_enum; using std::is_enum;
using std::unordered_set; using std::unordered_set;
using std::unordered_map; 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; namespace cpp0x = cpp11;

View File

@ -45,7 +45,6 @@
#include <CGAL/Mesher_level_visitors.h> #include <CGAL/Mesher_level_visitors.h>
#include <CGAL/Kernel_traits.h> #include <CGAL/Kernel_traits.h>
#include <CGAL/point_generators_3.h> #include <CGAL/point_generators_3.h>
#include <CGAL/atomic.h>
#ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE #ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
#include <CGAL/Surface_mesher/Surface_mesher_visitor.h> #include <CGAL/Surface_mesher/Surface_mesher_visitor.h>
@ -65,6 +64,7 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <string> #include <string>
#include <atomic>
namespace CGAL { namespace CGAL {
namespace Mesh_3 { namespace Mesh_3 {
@ -222,7 +222,7 @@ public:
std::size_t maximal_number_of_vertices = 0, std::size_t maximal_number_of_vertices = 0,
Mesh_error_code* error_code = 0 Mesh_error_code* error_code = 0
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr = 0 , std::atomic<bool>* stop_ptr = 0
#endif #endif
); );
@ -294,7 +294,7 @@ private:
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
/// Pointer to the atomic Boolean that can stop the process /// Pointer to the atomic Boolean that can stop the process
CGAL::cpp11::atomic<bool>* const stop_ptr; std::atomic<bool>* const stop_ptr;
#endif #endif
#ifdef CGAL_LINKED_WITH_TBB #ifdef CGAL_LINKED_WITH_TBB
@ -318,7 +318,7 @@ private:
bool forced_stop() const { bool forced_stop() const {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(stop_ptr != 0 && 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; if(error_code_ != 0) *error_code_ = CGAL_MESH_3_STOPPED;
return true; return true;
@ -353,7 +353,7 @@ Mesher_3<C3T3,MC,MD>::Mesher_3(C3T3& c3t3,
std::size_t maximal_number_of_vertices, std::size_t maximal_number_of_vertices,
Mesh_error_code* error_code Mesh_error_code* error_code
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Base(c3t3.bbox(), : Base(c3t3.bbox(),

View File

@ -23,7 +23,6 @@
#include <CGAL/Mesh_3/Profiling_tools.h> #include <CGAL/Mesh_3/Profiling_tools.h>
#endif #endif
#include <CGAL/atomic.h>
#include <CGAL/Mesh_3/Worksharing_data_structures.h> #include <CGAL/Mesh_3/Worksharing_data_structures.h>
#ifdef CGAL_CONCURRENT_MESH_3_PROFILING #ifdef CGAL_CONCURRENT_MESH_3_PROFILING
@ -37,7 +36,7 @@
# include <tbb/task_group.h> # include <tbb/task_group.h>
#endif #endif
#include <string> #include <atomic>
namespace CGAL { namespace Mesh_3 { namespace CGAL { namespace Mesh_3 {
@ -677,7 +676,7 @@ public:
void set_lock_ds(Lock_data_structure *) {} void set_lock_ds(Lock_data_structure *) {}
void set_worksharing_ds(WorksharingDataStructureType *) {} void set_worksharing_ds(WorksharingDataStructureType *) {}
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
void set_stop_pointer(CGAL::cpp11::atomic<bool>*) {} void set_stop_pointer(std::atomic<bool>*) {}
#endif #endif
protected: protected:
@ -1147,7 +1146,7 @@ public:
} }
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
void set_stop_pointer(CGAL::cpp11::atomic<bool>* stop_ptr) void set_stop_pointer(std::atomic<bool>* stop_ptr)
{ {
m_stop_ptr = stop_ptr; m_stop_ptr = stop_ptr;
} }
@ -1156,7 +1155,7 @@ public:
bool forced_stop() const { bool forced_stop() const {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(m_stop_ptr != 0 && 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); CGAL_assertion(m_task_group != 0);
m_task_group->cancel(); m_task_group->cancel();
@ -1177,7 +1176,7 @@ protected:
tbb::task_group *m_task_group; tbb::task_group *m_task_group;
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
CGAL::cpp11::atomic<bool>* m_stop_ptr; std::atomic<bool>* m_stop_ptr;
#endif #endif
private: private:

View File

@ -46,7 +46,6 @@
#include <CGAL/iterator.h> #include <CGAL/iterator.h>
#include <CGAL/number_utils.h> #include <CGAL/number_utils.h>
#include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/atomic.h>
#include <CGAL/boost/iterator/transform_iterator.hpp> #include <CGAL/boost/iterator/transform_iterator.hpp>
@ -70,6 +69,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <atomic>
namespace CGAL { namespace CGAL {
namespace Mesh_3 { namespace Mesh_3 {
@ -143,7 +143,7 @@ public:
std::size_t maximal_number_of_vertices = 0, std::size_t maximal_number_of_vertices = 0,
Mesh_error_code* error_code = 0 Mesh_error_code* error_code = 0
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr = 0 , std::atomic<bool>* stop_ptr = 0
#endif #endif
); );
@ -156,7 +156,7 @@ public:
bool forced_stop() const { bool forced_stop() const {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(stop_ptr_ != 0 && 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; if(error_code_ != 0) *error_code_ = CGAL_MESH_3_STOPPED;
return true; return true;
@ -469,7 +469,7 @@ private:
Mesh_error_code* const error_code_; Mesh_error_code* const error_code_;
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
/// Pointer to the atomic Boolean that can stop the process /// Pointer to the atomic Boolean that can stop the process
CGAL::cpp11::atomic<bool>* const stop_ptr_; std::atomic<bool>* const stop_ptr_;
#endif #endif
}; };
@ -481,7 +481,7 @@ Protect_edges_sizing_field(C3T3& c3t3, const MD& domain,
std::size_t maximal_number_of_vertices, std::size_t maximal_number_of_vertices,
Mesh_error_code* error_code Mesh_error_code* error_code
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: c3t3_(c3t3) : c3t3_(c3t3)

View File

@ -26,7 +26,6 @@
#include <tbb/blocked_range.h> #include <tbb/blocked_range.h>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#endif #endif
#include <CGAL/atomic.h>
#include <CGAL/Meshes/Filtered_deque_container.h> #include <CGAL/Meshes/Filtered_deque_container.h>
#include <CGAL/Meshes/Filtered_multimap_container.h> #include <CGAL/Meshes/Filtered_multimap_container.h>
@ -41,7 +40,7 @@
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <sstream> #include <sstream>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -319,7 +318,7 @@ public:
C3T3& c3t3, C3T3& c3t3,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
); );
// For parallel // For parallel
@ -332,7 +331,7 @@ public:
WorksharingDataStructureType *worksharing_ds, WorksharingDataStructureType *worksharing_ds,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
); );
@ -372,7 +371,7 @@ public:
{ {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(m_stop_ptr != 0 && 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; return true;
} }
@ -573,7 +572,7 @@ private:
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
/// Pointer to the atomic Boolean that can stop the process /// Pointer to the atomic Boolean that can stop the process
CGAL::cpp11::atomic<bool>* const m_stop_ptr; std::atomic<bool>* const m_stop_ptr;
#endif #endif
private: private:
// Disabled copy constructor // Disabled copy constructor
@ -595,7 +594,7 @@ Refine_cells_3(Tr& triangulation,
C3T3& c3t3, C3T3& c3t3,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Mesher_level<Tr, Self, Cell_handle, P_, : Mesher_level<Tr, Self, Cell_handle, P_,
@ -628,7 +627,7 @@ Refine_cells_3(Tr& triangulation,
WorksharingDataStructureType *worksharing_ds, WorksharingDataStructureType *worksharing_ds,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Mesher_level<Tr, Self, Cell_handle, P_, : Mesher_level<Tr, Self, Cell_handle, P_,

View File

@ -41,7 +41,6 @@
#include <CGAL/Mesh_3/Dump_c3t3.h> #include <CGAL/Mesh_3/Dump_c3t3.h>
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <CGAL/atomic.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
@ -51,6 +50,7 @@
#include <CGAL/tuple.h> #include <CGAL/tuple.h>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <sstream> #include <sstream>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -255,7 +255,7 @@ public:
const Criteria& criteria, const Criteria& criteria,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: r_tr_(tr) : r_tr_(tr)
@ -275,7 +275,7 @@ public:
{ {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(m_stop_ptr != 0 && 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; return true;
} }
@ -615,7 +615,7 @@ protected:
std::size_t m_maximal_number_of_vertices_; std::size_t m_maximal_number_of_vertices_;
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
/// Pointer to the atomic Boolean that can stop the process /// Pointer to the atomic Boolean that can stop the process
CGAL::cpp11::atomic<bool>* const m_stop_ptr; std::atomic<bool>* const m_stop_ptr;
#endif #endif
}; // end class template Refine_facets_3_base }; // end class template Refine_facets_3_base
@ -783,7 +783,7 @@ public:
int mesh_topology, int mesh_topology,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
); );
// For parallel // For parallel
@ -796,7 +796,7 @@ public:
WorksharingDataStructureType *worksharing_ds, WorksharingDataStructureType *worksharing_ds,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
); );
@ -916,7 +916,7 @@ Refine_facets_3(Tr& triangulation,
int mesh_topology, int mesh_topology,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Rf_base(triangulation, c3t3, oracle, criteria, mesh_topology, : Rf_base(triangulation, c3t3, oracle, criteria, mesh_topology,
@ -945,7 +945,7 @@ Refine_facets_3(Tr& triangulation,
WorksharingDataStructureType *worksharing_ds, WorksharingDataStructureType *worksharing_ds,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Rf_base(triangulation, c3t3, oracle, criteria, maximal_number_of_vertices : Rf_base(triangulation, c3t3, oracle, criteria, maximal_number_of_vertices

View File

@ -19,7 +19,6 @@
#include <CGAL/Mesh_facet_topology.h> #include <CGAL/Mesh_facet_topology.h>
#include <CGAL/atomic.h>
#include <CGAL/utility.h> #include <CGAL/utility.h>
#include <CGAL/Time_stamper.h> #include <CGAL/Time_stamper.h>
@ -31,6 +30,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -308,7 +308,7 @@ public:
int mesh_topology, int mesh_topology,
std::size_t maximal_number_of_vertices std::size_t maximal_number_of_vertices
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* stop_ptr , std::atomic<bool>* stop_ptr
#endif #endif
) )
: Base(triangulation, : Base(triangulation,
@ -446,7 +446,7 @@ public:
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
if(this->m_stop_ptr != 0 && 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; return true;
} }

View File

@ -28,6 +28,7 @@
#include <CGAL/Mesh_3/io_signature.h> #include <CGAL/Mesh_3/io_signature.h>
#include <CGAL/Has_timestamp.h> #include <CGAL/Has_timestamp.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -65,6 +66,13 @@ template <>
class Mesh_vertex_base_3_base<Parallel_tag> class Mesh_vertex_base_3_base<Parallel_tag>
{ {
public: 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) // Erase counter (cf. Compact_container)
unsigned int erase_counter() const unsigned int erase_counter() const
@ -81,7 +89,7 @@ public:
} }
protected: protected:
typedef tbb::atomic<unsigned int> Erase_counter_type; typedef std::atomic<unsigned int> Erase_counter_type;
Erase_counter_type m_erase_counter; Erase_counter_type m_erase_counter;
}; };

View File

@ -32,6 +32,8 @@
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/parameter/preprocessor.hpp> #include <boost/parameter/preprocessor.hpp>
#include <atomic>
namespace CGAL { namespace CGAL {
namespace parameters { namespace parameters {
@ -192,7 +194,7 @@ void init_c3t3_with_features(C3T3& c3t3,
std::size_t maximal_number_of_vertices = 0, std::size_t maximal_number_of_vertices = 0,
Mesh_error_code* pointer_to_error_code = 0 Mesh_error_code* pointer_to_error_code = 0
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
, CGAL::cpp11::atomic<bool>* pointer_to_stop = 0 , std::atomic<bool>* pointer_to_stop = 0
#endif #endif
) )
{ {

View File

@ -28,10 +28,11 @@
#include <CGAL/Mesh_3/Mesher_3.h> #include <CGAL/Mesh_3/Mesher_3.h>
#include <CGAL/Mesh_error_code.h> #include <CGAL/Mesh_error_code.h>
#include <CGAL/optimize_mesh_3.h> #include <CGAL/optimize_mesh_3.h>
#include <CGAL/atomic.h>
#include <boost/parameter/preprocessor.hpp> #include <boost/parameter/preprocessor.hpp>
#include <atomic>
namespace CGAL { namespace CGAL {
namespace details { namespace details {
@ -196,7 +197,7 @@ struct Manifold_options {
// Various Mesh_3 option // Various Mesh_3 option
struct Mesh_3_options { struct Mesh_3_options {
#ifndef CGAL_NO_ATOMIC #ifndef CGAL_NO_ATOMIC
typedef CGAL::cpp11::atomic<bool>* Pointer_to_stop_atomic_boolean_t; typedef std::atomic<bool>* Pointer_to_stop_atomic_boolean_t;
#else #else
typedef bool* Pointer_to_stop_atomic_boolean_t; typedef bool* Pointer_to_stop_atomic_boolean_t;
#endif #endif

View File

@ -15,9 +15,6 @@
#include <CGAL/license/Nef_3.h> #include <CGAL/license/Nef_3.h>
#include <CGAL/atomic.h>
#include <CGAL/Nef_3/Vertex.h> #include <CGAL/Nef_3/Vertex.h>
#include <CGAL/Nef_3/Halfedge.h> #include <CGAL/Nef_3/Halfedge.h>
#include <CGAL/Nef_3/Halffacet.h> #include <CGAL/Nef_3/Halffacet.h>
@ -26,6 +23,8 @@
#include <CGAL/Nef_3/SHalfloop.h> #include <CGAL/Nef_3/SHalfloop.h>
#include <CGAL/Nef_3/SFace.h> #include <CGAL/Nef_3/SFace.h>
#include <atomic>
#undef CGAL_NEF_DEBUG #undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 83 #define CGAL_NEF_DEBUG 83
#include <CGAL/Nef_2/debug.h> #include <CGAL/Nef_2/debug.h>
@ -42,7 +41,7 @@ class Index_generator {
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static int unique; static int unique;
#else #else
static CGAL::cpp11::atomic<int> unique; static std::atomic<int> unique;
#endif #endif
return unique++; return unique++;
} }

View File

@ -19,9 +19,9 @@
#define CGAL_COUNTED_NUMBER_H #define CGAL_COUNTED_NUMBER_H
#include <CGAL/number_type_basic.h> #include <CGAL/number_type_basic.h>
#include <CGAL/atomic.h>
#include <CGAL/boost/iterator/transform_iterator.hpp> // for Root_of_selector #include <CGAL/boost/iterator/transform_iterator.hpp> // for Root_of_selector
#include <iostream> #include <iostream>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -30,7 +30,7 @@ class Counted_number {
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static unsigned long static unsigned long
#else #else
static CGAL::cpp11::atomic<unsigned long> static std::atomic<unsigned long>
#endif #endif
s_neg_count, s_add_count, s_sub_count, s_neg_count, s_add_count, s_sub_count,
s_mul_count, s_div_count, s_mul_count, s_div_count,
@ -280,64 +280,64 @@ template< class NT >
unsigned long Counted_number<NT>::s_mod_count = 0; unsigned long Counted_number<NT>::s_mod_count = 0;
#else #else
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_neg_count; std::atomic<unsigned long> Counted_number<NT>::s_neg_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_add_count; std::atomic<unsigned long> Counted_number<NT>::s_add_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_sub_count; std::atomic<unsigned long> Counted_number<NT>::s_sub_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_mul_count; std::atomic<unsigned long> Counted_number<NT>::s_mul_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_div_count; std::atomic<unsigned long> Counted_number<NT>::s_div_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_eq_count; std::atomic<unsigned long> Counted_number<NT>::s_eq_count;
template <class NT> template <class NT>
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_comp_count; std::atomic<unsigned long> Counted_number<NT>::s_comp_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_simplify_count; std::atomic<unsigned long> Counted_number<NT>::s_simplify_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_unit_part_count; std::atomic<unsigned long> Counted_number<NT>::s_unit_part_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_is_zero_count; std::atomic<unsigned long> Counted_number<NT>::s_is_zero_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_is_one_count; std::atomic<unsigned long> Counted_number<NT>::s_is_one_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_square_count; std::atomic<unsigned long> Counted_number<NT>::s_square_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_integral_division_count; std::atomic<unsigned long> Counted_number<NT>::s_integral_division_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_is_square_count; std::atomic<unsigned long> Counted_number<NT>::s_is_square_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_sqrt_count; std::atomic<unsigned long> Counted_number<NT>::s_sqrt_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_kth_root_count; std::atomic<unsigned long> Counted_number<NT>::s_kth_root_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_root_of_count; std::atomic<unsigned long> Counted_number<NT>::s_root_of_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_gcd_count; std::atomic<unsigned long> Counted_number<NT>::s_gcd_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_div_mod_count; std::atomic<unsigned long> Counted_number<NT>::s_div_mod_count;
template< class NT > template< class NT >
CGAL::cpp11::atomic<unsigned long> Counted_number<NT>::s_mod_count; std::atomic<unsigned long> Counted_number<NT>::s_mod_count;
#endif #endif

View File

@ -13,10 +13,10 @@
#define CGAL_PSP_INTERNAL_CALLBACK_WRAPPER_H #define CGAL_PSP_INTERNAL_CALLBACK_WRAPPER_H
#include <CGAL/license/Point_set_processing_3.h> #include <CGAL/license/Point_set_processing_3.h>
#include <atomic>
#include <thread>
#include <functional> #include <functional>
#include <CGAL/thread.h>
namespace CGAL { namespace CGAL {
namespace Point_set_processing_3 { namespace Point_set_processing_3 {
@ -91,11 +91,11 @@ template <>
class Callback_wrapper<CGAL::Parallel_tag> class Callback_wrapper<CGAL::Parallel_tag>
{ {
const std::function<bool(double)>& m_callback; const std::function<bool(double)>& m_callback;
cpp11::atomic<std::size_t>* m_advancement; std::atomic<std::size_t>* m_advancement;
cpp11::atomic<bool>* m_interrupted; std::atomic<bool>* m_interrupted;
std::size_t m_size; std::size_t m_size;
bool m_creator; bool m_creator;
cpp11::thread* m_thread; std::thread* m_thread;
// assignment operator shouldn't be used (m_callback is const ref) // assignment operator shouldn't be used (m_callback is const ref)
Callback_wrapper& operator= (const Callback_wrapper&) Callback_wrapper& operator= (const Callback_wrapper&)
@ -109,17 +109,17 @@ public:
std::size_t advancement = 0, std::size_t advancement = 0,
bool interrupted = false) bool interrupted = false)
: m_callback (callback) : m_callback (callback)
, m_advancement (new cpp11::atomic<std::size_t>()) , m_advancement (new std::atomic<std::size_t>())
, m_interrupted (new cpp11::atomic<bool>()) , m_interrupted (new std::atomic<bool>())
, m_size (size) , m_size (size)
, m_creator (true) , m_creator (true)
, m_thread (nullptr) , 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_advancement = advancement;
*m_interrupted = interrupted; *m_interrupted = interrupted;
if (m_callback) if (m_callback)
m_thread = new cpp11::thread (*this); m_thread = new std::thread (*this);
} }
Callback_wrapper (const Callback_wrapper& other) Callback_wrapper (const Callback_wrapper& other)
@ -150,11 +150,11 @@ public:
*m_advancement = advancement; *m_advancement = advancement;
*m_interrupted = interrupted; *m_interrupted = interrupted;
if (m_callback) if (m_callback)
m_thread = new cpp11::thread (*this); m_thread = new std::thread (*this);
} }
cpp11::atomic<std::size_t>& advancement() { return *m_advancement; } std::atomic<std::size_t>& advancement() { return *m_advancement; }
cpp11::atomic<bool>& interrupted() { return *m_interrupted; } std::atomic<bool>& interrupted() { return *m_interrupted; }
void join() void join()
{ {
if (m_thread != nullptr) if (m_thread != nullptr)
@ -169,7 +169,9 @@ public:
*m_interrupted = true; *m_interrupted = true;
if (*m_interrupted) if (*m_interrupted)
return; 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) if (m_callback)
m_callback (1.); m_callback (1.);

View File

@ -3,10 +3,11 @@
#include <QProgressDialog> #include <QProgressDialog>
#include <CGAL/Real_timer.h> #include <CGAL/Real_timer.h>
#include <CGAL/thread.h>
#include "Callback_signaler.h" #include "Callback_signaler.h"
#include <atomic>
typedef CGAL::Parallel_if_available_tag Concurrency_tag; typedef CGAL::Parallel_if_available_tag Concurrency_tag;
class Signal_callback class Signal_callback
@ -112,12 +113,14 @@ void run_with_qprogressdialog (Functor& functor,
#ifdef CGAL_HAS_STD_THREADS #ifdef CGAL_HAS_STD_THREADS
if (boost::is_convertible<ConcurrencyTag, CGAL::Parallel_tag>::value) if (boost::is_convertible<ConcurrencyTag, CGAL::Parallel_tag>::value)
{ {
CGAL::cpp11::thread thread (functor); std::thread thread (functor);
while (*signal_callback->latest_adv != 1. && while (*signal_callback->latest_adv != 1. &&
*signal_callback->state) *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 (); QApplication::processEvents ();
} }

View File

@ -48,6 +48,7 @@
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include <map> #include <map>
#include <atomic>
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
@ -92,7 +93,7 @@ struct Profile_counter
Profile_counter(const std::string & ss) Profile_counter(const std::string & ss)
: s(ss) : s(ss)
{ {
i = 0; // needed here because of tbb::atomic i = 0; // needed here because of std::atomic
} }
void operator++() { ++i; } void operator++() { ++i; }
@ -107,7 +108,7 @@ struct Profile_counter
private: private:
#ifdef CGAL_CONCURRENT_PROFILE #ifdef CGAL_CONCURRENT_PROFILE
tbb::atomic<unsigned int> i; std::atomic<unsigned int> i;
#else #else
unsigned int i; unsigned int i;
#endif #endif
@ -167,7 +168,7 @@ struct Profile_branch_counter
Profile_branch_counter(const std::string & ss) Profile_branch_counter(const std::string & ss)
: s(ss) : s(ss)
{ {
i = j = 0; // needed here because of tbb::atomic i = j = 0; // needed here because of std::atomic
} }
void operator++() { ++i; } void operator++() { ++i; }
@ -183,7 +184,7 @@ struct Profile_branch_counter
private: private:
#ifdef CGAL_CONCURRENT_PROFILE #ifdef CGAL_CONCURRENT_PROFILE
tbb::atomic<unsigned int> i, j; std::atomic<unsigned int> i, j;
#else #else
unsigned int i, j; unsigned int i, j;
#endif #endif
@ -196,7 +197,7 @@ struct Profile_branch_counter_3
Profile_branch_counter_3(const std::string & ss) Profile_branch_counter_3(const std::string & ss)
: s(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; } void operator++() { ++i; }
@ -214,7 +215,7 @@ struct Profile_branch_counter_3
private: private:
#ifdef CGAL_CONCURRENT_PROFILE #ifdef CGAL_CONCURRENT_PROFILE
tbb::atomic<unsigned int> i, j, k; std::atomic<unsigned int> i, j, k;
#else #else
unsigned int i, j, k; unsigned int i, j, k;
#endif #endif

View File

@ -31,7 +31,6 @@
#include <CGAL/iterator.h> #include <CGAL/iterator.h>
#include <CGAL/CC_safe_handle.h> #include <CGAL/CC_safe_handle.h>
#include <CGAL/Time_stamper.h> #include <CGAL/Time_stamper.h>
#include <CGAL/atomic.h>
#include <tbb/enumerable_thread_specific.h> #include <tbb/enumerable_thread_specific.h>
#include <tbb/queuing_mutex.h> #include <tbb/queuing_mutex.h>

View File

@ -13,7 +13,6 @@
#define CGAL_TIME_STAMPER_H #define CGAL_TIME_STAMPER_H
#include <CGAL/Has_timestamp.h> #include <CGAL/Has_timestamp.h>
#include <CGAL/atomic.h>
namespace CGAL { namespace CGAL {

View File

@ -12,6 +12,9 @@
#ifndef CGAL_THREAD_H #ifndef CGAL_THREAD_H
#define CGAL_THREAD_H #define CGAL_THREAD_H
#define CGAL_DEPRECATED_HEADER "<CGAL/thread.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/config.h>"
#include <CGAL/config.h> #include <CGAL/config.h>
/* /*