From 88142b29970c2f4e95b224a44406120862b95f28 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 16 Dec 2014 13:02:39 +0100 Subject: [PATCH 1/2] fix compilation for TBB 4.3 this partial specialization was only used for testing, so it can be removed The problem comes from the std::vector of mutex(s), which can't be copied using the std::vector operator= --- .../include/CGAL/Spatial_lock_grid_3.h | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h index c2a389361b0..14a5e869790 100644 --- a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h +++ b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h @@ -606,64 +606,6 @@ protected: TLS_thread_uint_ids m_tls_thread_ids; }; -//***************************************************************************** -// class Spatial_lock_grid_3 -// Note: undocumented, for testing only... -//***************************************************************************** - -template <> -class Spatial_lock_grid_3 - : public Spatial_lock_grid_base_3< - Spatial_lock_grid_3 > -{ - typedef Spatial_lock_grid_base_3< - Spatial_lock_grid_3 > Base; - -public: - // Constructors - Spatial_lock_grid_3(const Bbox_3 &bbox, int num_grid_cells_per_axis) - : Base(bbox, num_grid_cells_per_axis) - { - int num_cells = - num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis; - m_grid.resize(num_cells); - } - - /// Destructor - ~Spatial_lock_grid_3() - { - } - - bool is_cell_locked_impl(int cell_index) - { - bool locked = m_grid[cell_index].try_lock(); - if (locked) - m_grid[cell_index].unlock(); - return !locked; - } - - template - bool try_lock_cell_impl(int cell_index) - { - bool success = m_grid[cell_index].try_lock(); - if (success) - { - get_thread_local_grid()[cell_index] = true; - m_tls_locked_cells.local().push_back(cell_index); - } - return success; - } - - void unlock_cell_impl(int cell_index) - { - m_grid[cell_index].unlock(); - } - -protected: - - std::vector m_grid; -}; - } //namespace CGAL #else // !CGAL_LINKED_WITH_TBB From 90a74c1bb67402edc5be4d842ac85b1b3955da34 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 16 Dec 2014 16:42:22 +0100 Subject: [PATCH 2/2] fix a bug that happens on vc10, because atomics are not initialized --- STL_Extension/include/CGAL/Spatial_lock_grid_3.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h index 14a5e869790..9fc2034da79 100644 --- a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h +++ b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h @@ -33,7 +33,6 @@ # include #endif #include -#include #include #include @@ -42,7 +41,6 @@ namespace CGAL { struct Tag_no_lock {}; struct Tag_non_blocking {}; -struct Tag_non_blocking_with_mutexes {}; struct Tag_priority_blocking {}; //***************************************************************************** @@ -527,6 +525,11 @@ public: int num_cells = num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis; m_grid.resize(num_cells); + // Explicitly initialize the atomics + std::vector >::iterator it = m_grid.begin(); + std::vector >::iterator it_end = m_grid.end(); + for ( ; it != it_end ; ++it) + *it = 0; } /// Destructor