mirror of https://github.com/CGAL/cgal
Merge pull request #7496 from lrineau/Triangulation_3-fix_regular_with_TBB-GF
Regular_triangulation_3: fix another race-condition
This commit is contained in:
commit
6ab1337951
|
|
@ -209,7 +209,7 @@ public:
|
||||||
int index_x = static_cast<int>( (CGAL::to_double(point.x()) - m_bbox.xmin()) * m_resolution_x);
|
int index_x = static_cast<int>( (CGAL::to_double(point.x()) - m_bbox.xmin()) * m_resolution_x);
|
||||||
//index_x = std::max( 0, std::min(index_x, m_num_grid_cells_per_axis - 1) );
|
//index_x = std::max( 0, std::min(index_x, m_num_grid_cells_per_axis - 1) );
|
||||||
index_x =
|
index_x =
|
||||||
(index_x < 0 ?
|
(index_x < 0 ? /// @TODO: use std::clamp
|
||||||
0
|
0
|
||||||
: (index_x >= m_num_grid_cells_per_axis ?
|
: (index_x >= m_num_grid_cells_per_axis ?
|
||||||
m_num_grid_cells_per_axis - 1
|
m_num_grid_cells_per_axis - 1
|
||||||
|
|
|
||||||
|
|
@ -2584,8 +2584,17 @@ remove(Vertex_handle v, bool *could_lock_zone)
|
||||||
if(!vertex_validity_check(v, tds()))
|
if(!vertex_validity_check(v, tds()))
|
||||||
return true; // vertex is already gone from the TDS, nothing to do
|
return true; // vertex is already gone from the TDS, nothing to do
|
||||||
|
|
||||||
Vertex_handle hint = v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0);
|
#ifndef CGAL_LINKED_WITH_TBB
|
||||||
|
using Vertex_handle_and_point = Vertex_handle;
|
||||||
|
#endif // not CGAL_LINKED_WITH_TBB
|
||||||
|
Vertex_handle_and_point hint_and_point{v->cell()->vertex(0) == v ? v->cell()->vertex(1) : v->cell()->vertex(0)};
|
||||||
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
|
const Vertex_handle& hint = hint_and_point.vh;
|
||||||
|
const Weighted_point& hint_point_mem = hint_and_point.wpt;
|
||||||
|
#else // not CGAL_LINKED_WITH_TBB
|
||||||
|
const Vertex_handle& hint = hint_and_point;
|
||||||
|
const Weighted_point& hint_point_mem = hint_and_point->point();
|
||||||
|
#endif // not CGAL_LINKED_WITH_TBB
|
||||||
Self tmp;
|
Self tmp;
|
||||||
Vertex_remover<Self> remover(tmp);
|
Vertex_remover<Self> remover(tmp);
|
||||||
removed = Tr_Base::remove(v, remover, could_lock_zone);
|
removed = Tr_Base::remove(v, remover, could_lock_zone);
|
||||||
|
|
@ -2612,13 +2621,12 @@ remove(Vertex_handle v, bool *could_lock_zone)
|
||||||
// the hint.
|
// the hint.
|
||||||
if(!vertex_validity_check(hint, tds()))
|
if(!vertex_validity_check(hint, tds()))
|
||||||
{
|
{
|
||||||
hint = finite_vertices_begin();
|
hint_and_point = finite_vertices_begin();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to make sure that while are locking the position P1 := hint->point(), 'hint'
|
// We need to make sure that while are locking the position P1 := hint->point(), 'hint'
|
||||||
// does not get its position changed to P2 != P1.
|
// does not get its position changed to P2 != P1.
|
||||||
const Weighted_point hint_point_mem = hint->point();
|
|
||||||
|
|
||||||
if(this->try_lock_point(hint_point_mem) && this->try_lock_point(wp))
|
if(this->try_lock_point(hint_point_mem) && this->try_lock_point(wp))
|
||||||
{
|
{
|
||||||
|
|
@ -2628,7 +2636,7 @@ remove(Vertex_handle v, bool *could_lock_zone)
|
||||||
if(!vertex_validity_check(hint, tds()) ||
|
if(!vertex_validity_check(hint, tds()) ||
|
||||||
hint->point() != hint_point_mem)
|
hint->point() != hint_point_mem)
|
||||||
{
|
{
|
||||||
hint = finite_vertices_begin();
|
hint_and_point = finite_vertices_begin();
|
||||||
this->unlock_all_elements();
|
this->unlock_all_elements();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2639,7 +2647,7 @@ remove(Vertex_handle v, bool *could_lock_zone)
|
||||||
{
|
{
|
||||||
success = true;
|
success = true;
|
||||||
if(hv != Vertex_handle())
|
if(hv != Vertex_handle())
|
||||||
hint = hv;
|
hint_and_point = hv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue