]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/thread/exceptions.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / thread / exceptions.hpp
1 // Copyright (C) 2001-2003
2 // William E. Kempf
3 // Copyright (C) 2007-9 Anthony Williams
4 //
5 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
6 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #ifndef BOOST_THREAD_EXCEPTIONS_PDM070801_H
9 #define BOOST_THREAD_EXCEPTIONS_PDM070801_H
10
11 #include <boost/thread/detail/config.hpp>
12
13 //  pdm: Sorry, but this class is used all over the place & I end up
14 //       with recursive headers if I don't separate it
15 //  wek: Not sure why recursive headers would cause compilation problems
16 //       given the include guards, but regardless it makes sense to
17 //       seperate this out any way.
18
19 #include <string>
20 #include <stdexcept>
21
22 #include <boost/config/abi_prefix.hpp>
23
24 namespace boost
25 {
26
27     class thread_interrupted
28     {};
29
30     class thread_exception:
31         public std::exception
32     {
33     protected:
34         thread_exception():
35             m_sys_err(0)
36         {}
37     
38         thread_exception(int sys_err_code):
39             m_sys_err(sys_err_code)
40         {}
41     
42
43     public:
44         ~thread_exception() throw()
45         {}
46     
47
48         int native_error() const
49         {
50             return m_sys_err;
51         }
52     
53
54     private:
55         int m_sys_err;
56     };
57
58     class condition_error:
59         public std::exception
60     {
61     public:
62         const char* what() const throw()
63         {
64             return "Condition error";
65         }
66     };
67     
68
69     class lock_error:
70         public thread_exception
71     {
72     public:
73         lock_error()
74         {}
75     
76         lock_error(int sys_err_code):
77             thread_exception(sys_err_code)
78         {}
79     
80         ~lock_error() throw()
81         {}
82     
83
84         virtual const char* what() const throw()
85         {
86             return "boost::lock_error";
87         }
88     };
89
90     class thread_resource_error:
91         public thread_exception
92     {
93     public:
94         thread_resource_error()
95         {}
96     
97         thread_resource_error(int sys_err_code):
98             thread_exception(sys_err_code)
99         {}
100     
101         ~thread_resource_error() throw()
102         {}
103     
104
105         virtual const char* what() const throw()
106         {
107             return "boost::thread_resource_error";
108         }
109     
110     };
111
112     class unsupported_thread_option:
113         public thread_exception
114     {
115     public:
116         unsupported_thread_option()
117         {}
118     
119         unsupported_thread_option(int sys_err_code):
120             thread_exception(sys_err_code)
121         {}
122     
123         ~unsupported_thread_option() throw()
124         {}
125     
126
127         virtual const char* what() const throw()
128         {
129             return "boost::unsupported_thread_option";
130         }
131     
132     };
133
134     class invalid_thread_argument:
135         public thread_exception
136     {
137     public:
138         invalid_thread_argument()
139         {}
140     
141         invalid_thread_argument(int sys_err_code):
142             thread_exception(sys_err_code)
143         {}
144     
145         ~invalid_thread_argument() throw()
146         {}
147     
148
149         virtual const char* what() const throw()
150         {
151             return "boost::invalid_thread_argument";
152         }
153     
154     };
155
156     class thread_permission_error:
157         public thread_exception
158     {
159     public:
160         thread_permission_error()
161         {}
162     
163         thread_permission_error(int sys_err_code):
164             thread_exception(sys_err_code)
165         {}
166     
167         ~thread_permission_error() throw()
168         {}
169     
170
171         virtual const char* what() const throw()
172         {
173             return "boost::thread_permission_error";
174         }
175     
176     };
177
178 } // namespace boost
179
180 #include <boost/config/abi_suffix.hpp>
181
182 #endif