diff --git a/gtsam/base/ThreadsafeException.h b/gtsam/base/ThreadsafeException.h index 15a76fbf1..0f7c6131d 100644 --- a/gtsam/base/ThreadsafeException.h +++ b/gtsam/base/ThreadsafeException.h @@ -11,7 +11,7 @@ /** * @file ThreadSafeException.h - * @brief Base exception type that uses tbb_exception if GTSAM is compiled with TBB + * @brief Base exception type that uses tbb_allocator if GTSAM is compiled with TBB * @author Richard Roberts * @date Aug 21, 2010 * @addtogroup base @@ -25,34 +25,28 @@ #include #include #include +#include #ifdef GTSAM_USE_TBB #include -#include #include #include #endif namespace gtsam { -/// Base exception type that uses tbb_exception if GTSAM is compiled with TBB. +/// Base exception type that uses tbb_allocator if GTSAM is compiled with TBB. template class ThreadsafeException: -#ifdef GTSAM_USE_TBB - public tbb::tbb_exception -#else public std::exception -#endif { -#ifdef GTSAM_USE_TBB private: - typedef tbb::tbb_exception Base; + typedef std::exception Base; +#ifdef GTSAM_USE_TBB protected: typedef std::basic_string, tbb::tbb_allocator > String; #else -private: - typedef std::exception Base; protected: typedef std::string String; #endif @@ -82,36 +76,6 @@ protected: } public: - // Implement functions for tbb_exception -#ifdef GTSAM_USE_TBB - virtual tbb::tbb_exception* move() throw () { - void* cloneMemory = scalable_malloc(sizeof(DERIVED)); - if (!cloneMemory) { - std::cerr << "Failed allocating memory to copy thrown exception, exiting now." << std::endl; - exit(-1); - } - DERIVED* clone = ::new(cloneMemory) DERIVED(static_cast(*this)); - clone->dynamic_ = true; - return clone; - } - - virtual void destroy() throw () { - if (dynamic_) { - DERIVED* derivedPtr = static_cast(this); - derivedPtr->~DERIVED(); - scalable_free(derivedPtr); - } - } - - virtual void throw_self() { - throw *static_cast(this); - } - - virtual const char* name() const throw () { - return typeid(DERIVED).name(); - } -#endif - virtual const char* what() const throw () { return description_ ? description_->c_str() : ""; } diff --git a/gtsam/base/types.h b/gtsam/base/types.h index bf3ed1bc3..d12a4209a 100644 --- a/gtsam/base/types.h +++ b/gtsam/base/types.h @@ -27,8 +27,9 @@ #include #include +#include + #ifdef GTSAM_USE_TBB -#include #include #endif