From 0695aa3fcdbe1aba94e707d3125b5770e6b45ec9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 6 Sep 2016 11:18:22 +0200 Subject: [PATCH] Protect a counter shared by all threads using atomic --- Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 cc528b3c50a..326beea1a0b 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h @@ -22,6 +22,7 @@ #define CGAL_NEF_SNC_INDEXED_ITEMS_H #include +#include #include #include @@ -42,7 +43,9 @@ class Index_generator { public: static int get_unique_index() { - CGAL_STATIC_THREAD_LOCAL_VARIABLE(int, unique, 0); + // initialized with 0 + // http://en.cppreference.com/w/cpp/language/zero_initialization + static CGAL::cpp11::atomic unique; return unique++; } };