-- cgit v1.2.3 From 3b83c563f5a9992b2eb9a82738e6eebbe471b3e4 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 6 Jan 2017 13:58:04 +0000 Subject: Test of thread_local solution git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/thread_local_no_static@1932 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a1f31ab16d2a086d38d0d019bbdc59152f8e02e7 --- src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h | 3 +-- src/Simplex_tree/include/gudhi/Simplex_tree.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index bc8099e6..b3339b7d 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -300,8 +300,7 @@ class Persistent_cohomology { // with multiplicity. We used to sum the coefficients directly in // annotations_in_boundary by using a map, we now do it later. typedef std::pair annotation_t; - // Danger: not thread-safe! - static std::vector annotations_in_boundary; + thread_local std::vector annotations_in_boundary; annotations_in_boundary.clear(); int sign = 1 - 2 * (dim_sigma % 2); // \in {-1,1} provides the sign in the // alternate sum in the boundary. diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 63e3f0e5..317bce23 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1029,7 +1029,7 @@ class Simplex_tree { Dictionary_it next = siblings->members().begin(); ++next; - static std::vector > inter; // static, not thread-safe. + thread_local std::vector > inter; for (Dictionary_it s_h = siblings->members().begin(); s_h != siblings->members().end(); ++s_h, ++next) { Simplex_handle root_sh = find_vertex(s_h->first); -- cgit v1.2.3