Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Multithreading, Contribution

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Multithreading, Contribution


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Multithreading, Contribution
  • Date: Thu, 22 Jan 2015 16:39:54 +0100
  • Organization: GeometryFactory

Hi Bernhard,

thanks for the patch, we'll look into it soon and let the list know
about the integration status.
We'll come back directly to you if we have any question.

Best,

Sebastien.

On 01/21/2015 12:06 PM, Bernhard Kornberger wrote:
Hello!


Last year researches from the Distributed and Parallel Systems Group
of the University of Innsbruck have parallelized one of my programs.
To this end they needed to patch CGAL to achieve thread safety for
the Exact_predicates_exact_constructions_kernel. Now I'd like to
contribute this patch and possibly start a discussion about it:

http://www.geom.at/_downloads/patch.diff

The patch is not my work, so I paste their description here:



### Copy&Paste start ###

The handler classes implement reference counting mechanisms. A simple
atomic increment
operation was added to the counter increment to avoid concurrent
alteration. To provide portability,
the boost::atomic tools were used, instead of using compiler dependent
built/in functions.
The current C++11 standard could have been used as well, std::atomic
provides with the same functionality and portability.
The modified files are: CGAL/Handle_for.h and CGAL/Handle.h

In CGAL/Lazy.h the version of the approx() method that is not constant
and do returns a reference to the inner
object was dropped. We want to avoid anyone from modify the state of the
object so we can enforce thread
safety. It seems that this method is not used during compilation and can
be safely deleted.
The Lazy_rep object keeps two objects that hold the approximate value:
at, that holds the
original approximate value, and at_exact that holds the exact value that
is recalculated inside
update_exact. In this way, a thread that calls approx and ta thread that
calls update_exact operate on
different objects and we can ensure thread safety.
Instead of utilizing a mutex to check whenever the approximate value has
being updated, the
check is done done via an atomic counter. This counter is initialized
with value 0 to represent that
the value is an approximation. The last statement of the update_exact
operation updates the value to
represent the fact that the value is no longer an approximation.

### Copy&Paste end ###


I hope that this contribution is useful.

Best regards
Bernhard Kornberger







Archive powered by MHonArc 2.6.18.

Top of Page