X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexceptions.h;h=6939f81a34765b68366d5b958019299e4a3f3ab8;hb=8ad854af828575e44db349eed7e9198932ec3d80;hp=268e8c36d200771d84e291ccd90e8f215da54c29;hpb=e60bb3e51bd1508b149e6b8f6608f09b5196ae26;p=dcpomatic.git diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 268e8c36d..6939f81a3 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -24,11 +24,9 @@ #ifndef DCPOMATIC_EXCEPTIONS_H #define DCPOMATIC_EXCEPTIONS_H -#include extern "C" { #include } -#include #include #include #include @@ -265,47 +263,12 @@ public: ProgrammingError (std::string file, int line); }; -/** @class ExceptionStore - * @brief A parent class for classes which have a need to catch and - * re-throw exceptions. - * - * This is intended for classes which run their own thread; they should do - * something like - * - * void my_thread () - * try { - * // do things which might throw exceptions - * } catch (...) { - * store_current (); - * } - * - * and then in another thread call rethrow(). If any - * exception was thrown by my_thread it will be stored by - * store_current() and then rethrow() will re-throw it where - * it can be handled. - */ -class ExceptionStore +class TextEncodingError : public StringError { public: - void rethrow () { - boost::mutex::scoped_lock lm (_mutex); - if (_exception) { - boost::exception_ptr tmp = _exception; - _exception = boost::exception_ptr (); - boost::rethrow_exception (tmp); - } - } - -protected: - - void store_current () { - boost::mutex::scoped_lock lm (_mutex); - _exception = boost::current_exception (); - } - -private: - boost::exception_ptr _exception; - mutable boost::mutex _mutex; + TextEncodingError (std::string s) + : StringError (s) + {} }; #endif