diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index e0179404d76..79db9c4bca3 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -27,6 +27,10 @@ #include #include +#ifdef CGAL_HAS_THREADS +#include +#endif + namespace CGAL { /** @@ -212,10 +216,17 @@ namespace CGAL { Primitives m_primitives; // single root node Node* m_p_root_node; - + #ifdef CGAL_HAS_THREADS + mutable boost::mutex internal_tree_mutex;//mutex used to protect const calls inducing build() + #endif + const Node* root_node() const { + #ifdef CGAL_HAS_THREADS + //this ensure that build() will be called once + boost::mutex::scoped_lock scoped_lock(internal_tree_mutex); + #endif if(m_need_build) - const_cast< AABB_tree* >(this)->build(); //THIS IS NOT THREADSAFE + const_cast< AABB_tree* >(this)->build(); return m_p_root_node; } diff --git a/Installation/changes.html b/Installation/changes.html index 08dfd411be6..a9950278076 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -107,7 +107,8 @@ CGAL 3.10 offers the following improvements and new functionality :

AABB tree

    -
  • Fix constness issues in the AABB_tree class.
  • +
  • Document constness of member functions of the AABB_tree class.
  • +
  • The class AABB_tree is now guarantee to be read-only thread-safe.

Release 3.9