1 // Copyright (C) 2001-2003
3 // Copyright (C) 2007-9 Anthony Williams
4 // (C) Copyright 2011-2012 Vicente J. Botet Escriba
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_THREAD_EXCEPTIONS_PDM070801_H
10 #define BOOST_THREAD_EXCEPTIONS_PDM070801_H
12 #include <boost/thread/detail/config.hpp>
14 // pdm: Sorry, but this class is used all over the place & I end up
15 // with recursive headers if I don't separate it
16 // wek: Not sure why recursive headers would cause compilation problems
17 // given the include guards, but regardless it makes sense to
18 // seperate this out any way.
22 #include <boost/system/system_error.hpp>
23 #include <boost/system/error_code.hpp>
26 #include <boost/config/abi_prefix.hpp>
31 #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
32 class BOOST_SYMBOL_VISIBLE thread_interrupted
36 class BOOST_SYMBOL_VISIBLE thread_exception:
37 public system::system_error
38 //public std::exception
40 typedef system::system_error base_type;
43 : base_type(0,system::generic_category())
46 thread_exception(int sys_error_code)
47 : base_type(sys_error_code, system::generic_category())
50 thread_exception( int ev, const char * what_arg )
51 : base_type(system::error_code(ev, system::generic_category()), what_arg)
54 thread_exception( int ev, const std::string & what_arg )
55 : base_type(system::error_code(ev, system::generic_category()), what_arg)
59 ~thread_exception() throw()
63 int native_error() const
65 return code().value();
70 class BOOST_SYMBOL_VISIBLE condition_error:
71 public system::system_error
72 //public std::exception
74 typedef system::system_error base_type;
77 : base_type(system::error_code(0, system::generic_category()), "Condition error")
79 condition_error( int ev )
80 : base_type(system::error_code(ev, system::generic_category()), "Condition error")
83 condition_error( int ev, const char * what_arg )
84 : base_type(system::error_code(ev, system::generic_category()), what_arg)
87 condition_error( int ev, const std::string & what_arg )
88 : base_type(system::error_code(ev, system::generic_category()), what_arg)
94 class BOOST_SYMBOL_VISIBLE lock_error:
95 public thread_exception
97 typedef thread_exception base_type;
100 : base_type(0, "boost::lock_error")
104 : base_type(ev, "boost::lock_error")
107 lock_error( int ev, const char * what_arg )
108 : base_type(ev, what_arg)
111 lock_error( int ev, const std::string & what_arg )
112 : base_type(ev, what_arg)
116 ~lock_error() throw()
121 class BOOST_SYMBOL_VISIBLE thread_resource_error:
122 public thread_exception
124 typedef thread_exception base_type;
126 thread_resource_error()
127 : base_type(static_cast<int>(system::errc::resource_unavailable_try_again), "boost::thread_resource_error")
130 thread_resource_error( int ev )
131 : base_type(ev, "boost::thread_resource_error")
134 thread_resource_error( int ev, const char * what_arg )
135 : base_type(ev, what_arg)
138 thread_resource_error( int ev, const std::string & what_arg )
139 : base_type(ev, what_arg)
144 ~thread_resource_error() throw()
149 class BOOST_SYMBOL_VISIBLE unsupported_thread_option:
150 public thread_exception
152 typedef thread_exception base_type;
154 unsupported_thread_option()
155 : base_type(static_cast<int>(system::errc::invalid_argument), "boost::unsupported_thread_option")
158 unsupported_thread_option( int ev )
159 : base_type(ev, "boost::unsupported_thread_option")
162 unsupported_thread_option( int ev, const char * what_arg )
163 : base_type(ev, what_arg)
166 unsupported_thread_option( int ev, const std::string & what_arg )
167 : base_type(ev, what_arg)
173 class BOOST_SYMBOL_VISIBLE invalid_thread_argument:
174 public thread_exception
176 typedef thread_exception base_type;
178 invalid_thread_argument()
179 : base_type(static_cast<int>(system::errc::invalid_argument), "boost::invalid_thread_argument")
182 invalid_thread_argument( int ev )
183 : base_type(ev, "boost::invalid_thread_argument")
186 invalid_thread_argument( int ev, const char * what_arg )
187 : base_type(ev, what_arg)
190 invalid_thread_argument( int ev, const std::string & what_arg )
191 : base_type(ev, what_arg)
197 class BOOST_SYMBOL_VISIBLE thread_permission_error:
198 public thread_exception
200 typedef thread_exception base_type;
202 thread_permission_error()
203 : base_type(static_cast<int>(system::errc::permission_denied), "boost::thread_permission_error")
206 thread_permission_error( int ev )
207 : base_type(ev, "boost::thread_permission_error")
210 thread_permission_error( int ev, const char * what_arg )
211 : base_type(ev, what_arg)
214 thread_permission_error( int ev, const std::string & what_arg )
215 : base_type(ev, what_arg)
223 #include <boost/config/abi_suffix.hpp>