Merge branch 'Mesh_3-fix_compilation_with_tbb43-GF' into releases/CGAL-4.5-branch

fix the compilation of Mesh_3 for TBB 4.3

Approved by the release manager
This commit is contained in:
Jane Tournois 2014-12-19 11:19:32 +01:00
commit 0ee08ef100
1 changed files with 5 additions and 60 deletions

View File

@ -33,7 +33,6 @@
# include <thread>
#endif
#include <tbb/enumerable_thread_specific.h>
#include <tbb/recursive_mutex.h>
#include <algorithm>
#include <vector>
@ -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<tbb::atomic<unsigned int> >::iterator it = m_grid.begin();
std::vector<tbb::atomic<unsigned int> >::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<Tag_non_blocking_with_mutexes>
// Note: undocumented, for testing only...
//*****************************************************************************
template <>
class Spatial_lock_grid_3<Tag_non_blocking_with_mutexes>
: public Spatial_lock_grid_base_3<
Spatial_lock_grid_3<Tag_non_blocking_with_mutexes> >
{
typedef Spatial_lock_grid_base_3<
Spatial_lock_grid_3<Tag_non_blocking_with_mutexes> > 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 no_spin>
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<tbb::recursive_mutex> m_grid;
};
} //namespace CGAL
#else // !CGAL_LINKED_WITH_TBB