mirror of https://github.com/CGAL/cgal
fixes
This commit is contained in:
parent
e3a20071a1
commit
35600534f0
|
|
@ -512,11 +512,9 @@ public:
|
||||||
|
|
||||||
Spatial_lock_grid_3(const Bbox_3 &bbox, int num_grid_cells_per_axis)
|
Spatial_lock_grid_3(const Bbox_3 &bbox, int num_grid_cells_per_axis)
|
||||||
: Base(bbox, num_grid_cells_per_axis),
|
: Base(bbox, num_grid_cells_per_axis),
|
||||||
m_tls_thread_priorities(init_TLS_thread_priorities),
|
m_grid(num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis),
|
||||||
m_grid(num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis)
|
m_tls_thread_priorities(init_TLS_thread_priorities)
|
||||||
{
|
{
|
||||||
int num_cells =
|
|
||||||
num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis;
|
|
||||||
// Explicitly initialize the atomics
|
// Explicitly initialize the atomics
|
||||||
std::vector<std::atomic<unsigned int> >::iterator it = m_grid.begin();
|
std::vector<std::atomic<unsigned int> >::iterator it = m_grid.begin();
|
||||||
std::vector<std::atomic<unsigned int> >::iterator it_end = m_grid.end();
|
std::vector<std::atomic<unsigned int> >::iterator it_end = m_grid.end();
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,8 @@ public:
|
||||||
// Random-pick an element to erase
|
// Random-pick an element to erase
|
||||||
int index_to_erase = rand() % m_values.size();
|
int index_to_erase = rand() % m_values.size();
|
||||||
// If it exists
|
// If it exists
|
||||||
if (m_free_elements[index_to_erase].compare_and_swap(true, false) == false)
|
bool comparand = false;
|
||||||
|
if (m_free_elements[index_to_erase].compare_exchange_weak(comparand, true) )
|
||||||
{
|
{
|
||||||
m_cont.erase(m_iterators[index_to_erase]);
|
m_cont.erase(m_iterators[index_to_erase]);
|
||||||
++m_num_erasures;
|
++m_num_erasures;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ int main()
|
||||||
ParallelTriangulation T(V.begin(), V.end(), &locking_ds);
|
ParallelTriangulation T(V.begin(), V.end(), &locking_ds);
|
||||||
t.stop();
|
t.stop();
|
||||||
std::cerr << "Parallel construction takes " << t.time() << " sec. with "
|
std::cerr << "Parallel construction takes " << t.time() << " sec. with "
|
||||||
<< tbb::task_scheduler_init::default_num_threads() << " threads" << std::endl;
|
<< std::thread::hardware_concurrency() << " threads" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue