change from deprecated tbb::mutex to std::mutex
parent
98a90221cc
commit
eb85762483
|
|
@ -19,31 +19,23 @@
|
|||
#include <gtsam/base/debug.h>
|
||||
#include <gtsam/config.h> // for GTSAM_USE_TBB
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
#include <tbb/mutex.h>
|
||||
#endif
|
||||
#include <mutex> // std::mutex, std::unique_lock
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
GTSAM_EXPORT FastMap<std::string, ValueWithDefault<bool, false> > debugFlags;
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
tbb::mutex debugFlagsMutex;
|
||||
#endif
|
||||
std::mutex debugFlagsMutex;
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool guardedIsDebug(const std::string& s) {
|
||||
#ifdef GTSAM_USE_TBB
|
||||
tbb::mutex::scoped_lock lock(debugFlagsMutex);
|
||||
#endif
|
||||
std::unique_lock<std::mutex> lock(debugFlagsMutex);
|
||||
return gtsam::debugFlags[s];
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void guardedSetDebug(const std::string& s, const bool v) {
|
||||
#ifdef GTSAM_USE_TBB
|
||||
tbb::mutex::scoped_lock lock(debugFlagsMutex);
|
||||
#endif
|
||||
std::unique_lock<std::mutex> lock(debugFlagsMutex);
|
||||
gtsam::debugFlags[s] = v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,12 +80,10 @@ static Point3 CalculateBestAxis(const Point3& n) {
|
|||
|
||||
/* ************************************************************************* */
|
||||
const Matrix32& Unit3::basis(OptionalJacobian<6, 2> H) const {
|
||||
#ifdef GTSAM_USE_TBB
|
||||
// NOTE(hayk): At some point it seemed like this reproducably resulted in
|
||||
// deadlock. However, I don't know why and I can no longer reproduce it.
|
||||
// It either was a red herring or there is still a latent bug left to debug.
|
||||
tbb::mutex::scoped_lock lock(B_mutex_);
|
||||
#endif
|
||||
std::unique_lock<std::mutex> lock(B_mutex_);
|
||||
|
||||
const bool cachedBasis = static_cast<bool>(B_);
|
||||
const bool cachedJacobian = static_cast<bool>(H_B_);
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
#include <tbb/mutex.h>
|
||||
#endif
|
||||
#include <mutex> // std::mutex
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
|
|
@ -47,9 +45,7 @@ private:
|
|||
mutable boost::optional<Matrix32> B_; ///< Cached basis
|
||||
mutable boost::optional<Matrix62> H_B_; ///< Cached basis derivative
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
mutable tbb::mutex B_mutex_; ///< Mutex to protect the cached basis.
|
||||
#endif
|
||||
mutable std::mutex B_mutex_; ///< Mutex to protect the cached basis.
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue