Chris@16: // Copyright (C) 2001-2003 Chris@16: // William E. Kempf Chris@16: // Copyright (C) 2007-9 Anthony Williams Chris@16: // (C) Copyright 2011-2012 Vicente J. Botet Escriba Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_THREAD_EXCEPTIONS_PDM070801_H Chris@16: #define BOOST_THREAD_EXCEPTIONS_PDM070801_H Chris@16: Chris@16: #include Chris@16: Chris@16: // pdm: Sorry, but this class is used all over the place & I end up Chris@16: // with recursive headers if I don't separate it Chris@16: // wek: Not sure why recursive headers would cause compilation problems Chris@16: // given the include guards, but regardless it makes sense to Chris@16: // seperate this out any way. Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: Chris@16: #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS Chris@16: class BOOST_SYMBOL_VISIBLE thread_interrupted Chris@16: {}; Chris@16: #endif Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE thread_exception: Chris@16: public system::system_error Chris@16: //public std::exception Chris@16: { Chris@16: typedef system::system_error base_type; Chris@16: public: Chris@16: thread_exception() Chris@16: : base_type(0,system::system_category()) Chris@16: {} Chris@16: Chris@16: thread_exception(int sys_error_code) Chris@16: : base_type(sys_error_code, system::system_category()) Chris@16: {} Chris@16: Chris@16: thread_exception( int ev, const char * what_arg ) Chris@16: : base_type(system::error_code(ev, system::system_category()), what_arg) Chris@16: { Chris@16: } Chris@16: thread_exception( int ev, const std::string & what_arg ) Chris@16: : base_type(system::error_code(ev, system::system_category()), what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: ~thread_exception() throw() Chris@16: {} Chris@16: Chris@16: Chris@16: int native_error() const Chris@16: { Chris@16: return code().value(); Chris@16: } Chris@16: Chris@16: }; Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE condition_error: Chris@16: public system::system_error Chris@16: //public std::exception Chris@16: { Chris@16: typedef system::system_error base_type; Chris@16: public: Chris@16: condition_error() Chris@16: : base_type(system::error_code(0, system::system_category()), "Condition error") Chris@16: {} Chris@16: condition_error( int ev ) Chris@16: : base_type(system::error_code(ev, system::system_category()), "Condition error") Chris@16: { Chris@16: } Chris@16: condition_error( int ev, const char * what_arg ) Chris@16: : base_type(system::error_code(ev, system::system_category()), what_arg) Chris@16: { Chris@16: } Chris@16: condition_error( int ev, const std::string & what_arg ) Chris@16: : base_type(system::error_code(ev, system::system_category()), what_arg) Chris@16: { Chris@16: } Chris@16: }; Chris@16: Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE lock_error: Chris@16: public thread_exception Chris@16: { Chris@16: typedef thread_exception base_type; Chris@16: public: Chris@16: lock_error() Chris@16: : base_type(0, "boost::lock_error") Chris@16: {} Chris@16: Chris@16: lock_error( int ev ) Chris@16: : base_type(ev, "boost::lock_error") Chris@16: { Chris@16: } Chris@16: lock_error( int ev, const char * what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: lock_error( int ev, const std::string & what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: ~lock_error() throw() Chris@16: {} Chris@16: Chris@16: }; Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE thread_resource_error: Chris@16: public thread_exception Chris@16: { Chris@16: typedef thread_exception base_type; Chris@16: public: Chris@16: thread_resource_error() Chris@101: : base_type(static_cast(system::errc::resource_unavailable_try_again), "boost::thread_resource_error") Chris@16: {} Chris@16: Chris@16: thread_resource_error( int ev ) Chris@16: : base_type(ev, "boost::thread_resource_error") Chris@16: { Chris@16: } Chris@16: thread_resource_error( int ev, const char * what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: thread_resource_error( int ev, const std::string & what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: Chris@16: ~thread_resource_error() throw() Chris@16: {} Chris@16: Chris@16: }; Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE unsupported_thread_option: Chris@16: public thread_exception Chris@16: { Chris@16: typedef thread_exception base_type; Chris@16: public: Chris@16: unsupported_thread_option() Chris@101: : base_type(static_cast(system::errc::invalid_argument), "boost::unsupported_thread_option") Chris@16: {} Chris@16: Chris@16: unsupported_thread_option( int ev ) Chris@16: : base_type(ev, "boost::unsupported_thread_option") Chris@16: { Chris@16: } Chris@16: unsupported_thread_option( int ev, const char * what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: unsupported_thread_option( int ev, const std::string & what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: }; Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE invalid_thread_argument: Chris@16: public thread_exception Chris@16: { Chris@16: typedef thread_exception base_type; Chris@16: public: Chris@16: invalid_thread_argument() Chris@101: : base_type(static_cast(system::errc::invalid_argument), "boost::invalid_thread_argument") Chris@16: {} Chris@16: Chris@16: invalid_thread_argument( int ev ) Chris@16: : base_type(ev, "boost::invalid_thread_argument") Chris@16: { Chris@16: } Chris@16: invalid_thread_argument( int ev, const char * what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: invalid_thread_argument( int ev, const std::string & what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: }; Chris@16: Chris@16: class BOOST_SYMBOL_VISIBLE thread_permission_error: Chris@16: public thread_exception Chris@16: { Chris@16: typedef thread_exception base_type; Chris@16: public: Chris@16: thread_permission_error() Chris@101: : base_type(static_cast(system::errc::permission_denied), "boost::thread_permission_error") Chris@16: {} Chris@16: Chris@16: thread_permission_error( int ev ) Chris@16: : base_type(ev, "boost::thread_permission_error") Chris@16: { Chris@16: } Chris@16: thread_permission_error( int ev, const char * what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: thread_permission_error( int ev, const std::string & what_arg ) Chris@16: : base_type(ev, what_arg) Chris@16: { Chris@16: } Chris@16: Chris@16: }; Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif