Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] CGAL+GMP and multithreading crash

Subject: CGAL users discussion list

List archive

[cgal-discuss] CGAL+GMP and multithreading crash


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] CGAL+GMP and multithreading crash
  • Date: Wed, 24 Jun 2009 13:40:33 +0200 (CEST)

hi,

i am using CGAL with exact arithmetic withGMP/MPFR.

I am running MSVC2005. To install CGAL i used CGAL-3.4-Setup.exe.
I compile with Multithreaded DLL (debug) runtime libs.

My app binds agains (for debug version) among other libs:

gmp-vc80-mt-gd.lib
mpfr-vc80-mt-gd.lib
CGAL_Core-vc80-mt-gd.lib
CGAL-vc80-mt-gd.lib

To speed up computation i changed my algorithm to use more than one thread.

i found out, that copying a Polygon_2 as an input for the threads is causing
my app to crash. it looks like:
Polygon_2 a;

// ... init a ...

Polygon_2 b_thread1;
Polygon_2 b_thread2;
Polygon_2 b_thread3;
Polygon_2 b_thread4;
b_thread1 = a;
b_thread2 = a;
b_thread3 = a;
b_thread4 = a;

// ... start 4 threads each using b_threadX

// CRASH

when i do a workaround like this to copy "a":

b_trheadX.push_back( Point_2( toDouble( a[0].x() ), toDouble( a[0].y() ) ) );

there is no crash.

It looks like assigining:
b_threadX = a;
does not realy do a seperate copy in memory and when using multiple threads
there happen evil things.

is there a clean way to do a copy of a Polygon_2 without that workaround? i
use exact numbers and toDouble() is rounding.

may it be a problem with CGAL-3.4-Setup.exe? maybe they are compiled not for
multithreading? any idea?



Archive powered by MHonArc 2.6.16.

Top of Page