From 48169e7776cc54fbb2e6894da673a834b4cd711b Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sat, 11 Jul 2015 21:14:45 -0700 Subject: [PATCH] restored mutex to original scope --- gtsam/geometry/Unit3.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gtsam/geometry/Unit3.cpp b/gtsam/geometry/Unit3.cpp index aad128816..922b1e940 100644 --- a/gtsam/geometry/Unit3.cpp +++ b/gtsam/geometry/Unit3.cpp @@ -74,6 +74,10 @@ static tbb::mutex unit3BasisMutex; /* ************************************************************************* */ const Matrix32& Unit3::basis() const { +#ifdef GTSAM_USE_TBB + tbb::mutex::scoped_lock lock(unit3BasisMutex); +#endif + // Return cached version if exists if (B_) return *B_; @@ -94,13 +98,8 @@ const Matrix32& Unit3::basis() const { Vector3 b2 = p_.cross(b1).normalized(); // Create the basis matrix - { -#ifdef GTSAM_USE_TBB - tbb::mutex::scoped_lock lock(unit3BasisMutex); -#endif - B_.reset(Matrix32()); - (*B_) << b1, b2; - } + B_.reset(Matrix32()); + (*B_) << b1, b2; return *B_; }