mirror of https://github.com/CGAL/cgal
test for thread safty of CGAL::Residue
This commit is contained in:
parent
57b0329dac
commit
41e2d1e3f2
|
|
@ -2518,6 +2518,7 @@ Modular_arithmetic/doc_tex/Modular_arithmetic_ref/main.tex -text
|
|||
Modular_arithmetic/examples/Modular_arithmetic/modular_filter.cpp -text
|
||||
Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h -text
|
||||
Modular_arithmetic/test/Modular_arithmetic/Modular_traits.cpp -text
|
||||
Modular_arithmetic/test/Modular_arithmetic/multi_threads.cpp -text
|
||||
Nef_2/demo/Nef_2/filtered_homogeneous_data/complex.nef -text svneol=native#application/octet-stream
|
||||
Nef_2/demo/Nef_2/filtered_homogeneous_data/symmdif.nef -text svneol=native#application/octet-stream
|
||||
Nef_2/demo/Nef_2/help/index.html svneol=native#text/html
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
// Author(s) : Michael Hemmer <mhemmer@uni-mainz.de>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <cassert>
|
||||
#include <CGAL/Residue.h>
|
||||
#include <CGAL/primes.h>
|
||||
#include <CGAL/Test/_test_algebraic_structure.h>
|
||||
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
// This file needs Open MP.
|
||||
// Use ,e.g. , gcc-4.3.1 with -fopenmp and -lgomp
|
||||
int main () {
|
||||
int tid;
|
||||
|
||||
//Beginning of parallel section. Fork a team of threads.
|
||||
//Specify variable scoping
|
||||
#pragma omp parallel private(tid)
|
||||
{
|
||||
tid = omp_get_thread_num();
|
||||
int old_prime = CGAL::CGALi::primes[0];
|
||||
int new_prime = CGAL::CGALi::primes[tid+1];
|
||||
assert(CGAL::Residue::get_current_prime() == old_prime);
|
||||
CGAL::Residue::set_current_prime(new_prime);
|
||||
assert(CGAL::Residue::get_current_prime() == new_prime);
|
||||
|
||||
typedef CGAL::Residue NT;
|
||||
typedef CGAL::Field_tag Tag;
|
||||
typedef CGAL::Tag_true Is_exact;
|
||||
CGAL::test_algebraic_structure<NT,Tag, Is_exact>();
|
||||
}
|
||||
}
|
||||
#else
|
||||
int main (){}
|
||||
#endif
|
||||
Loading…
Reference in New Issue