diff --git a/STL_Extension/include/CGAL/Spatial_lock_grid_3.h b/STL_Extension/include/CGAL/Spatial_lock_grid_3.h index c2a389361b0..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 @@ -606,64 +609,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