]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/fiber/exceptions.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / fiber / exceptions.hpp
1 //
2 // Copyright Oliver Kowalke 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 // based on boost.thread
8
9 #ifndef BOOST_fiber_errorS_H
10 #define BOOST_fiber_errorS_H
11
12 #include <future>
13 #include <stdexcept>
14 #include <string>
15 #include <system_error>
16
17 #include <boost/config.hpp>
18
19 #include <boost/fiber/detail/config.hpp>
20
21 #ifdef BOOST_HAS_ABI_HEADERS
22 # include BOOST_ABI_PREFIX
23 #endif
24
25 namespace boost {
26 namespace fibers {
27
28 class fiber_error : public std::system_error {
29 public:
30 fiber_error( std::error_code ec) :
31 std::system_error{ ec } {
32 }
33
34 fiber_error( std::error_code ec, const char * what_arg) :
35 std::system_error{ ec, what_arg } {
36 }
37
38 fiber_error( std::error_code ec, std::string const& what_arg) :
39 std::system_error{ ec, what_arg } {
40 }
41
42 virtual ~fiber_error() = default;
43 };
44
45 class lock_error : public fiber_error {
46 public:
47 lock_error( std::error_code ec) :
48 fiber_error{ ec } {
49 }
50
51 lock_error( std::error_code ec, const char * what_arg) :
52 fiber_error{ ec, what_arg } {
53 }
54
55 lock_error( std::error_code ec, std::string const& what_arg) :
56 fiber_error{ ec, what_arg } {
57 }
58 };
59
60 enum class future_errc {
61 broken_promise = 1,
62 future_already_retrieved,
63 promise_already_satisfied,
64 no_state
65 };
66
67 BOOST_FIBERS_DECL
68 std::error_category const& future_category() noexcept;
69
70 }}
71
72 namespace std {
73
74 template<>
75 struct is_error_code_enum< boost::fibers::future_errc > : public true_type {
76 };
77
78 inline
79 std::error_code make_error_code( boost::fibers::future_errc e) noexcept {
80 return std::error_code{ static_cast< int >( e), boost::fibers::future_category() };
81 }
82
83 inline
84 std::error_condition make_error_condition( boost::fibers::future_errc e) noexcept {
85 return std::error_condition{ static_cast< int >( e), boost::fibers::future_category() };
86 }
87
88 }
89
90 namespace boost {
91 namespace fibers {
92
93 class future_error : public fiber_error {
94 public:
95 future_error( std::error_code ec) :
96 fiber_error{ ec } {
97 }
98 };
99
100 class future_uninitialized : public future_error {
101 public:
102 future_uninitialized() :
103 future_error{ std::make_error_code( future_errc::no_state) } {
104 }
105 };
106
107 class future_already_retrieved : public future_error {
108 public:
109 future_already_retrieved() :
110 future_error{ std::make_error_code( future_errc::future_already_retrieved) } {
111 }
112 };
113
114 class broken_promise : public future_error {
115 public:
116 broken_promise() :
117 future_error{ std::make_error_code( future_errc::broken_promise) } {
118 }
119 };
120
121 class promise_already_satisfied : public future_error {
122 public:
123 promise_already_satisfied() :
124 future_error{ std::make_error_code( future_errc::promise_already_satisfied) } {
125 }
126 };
127
128 class promise_uninitialized : public future_error {
129 public:
130 promise_uninitialized() :
131 future_error{ std::make_error_code( future_errc::no_state) } {
132 }
133 };
134
135 class packaged_task_uninitialized : public future_error {
136 public:
137 packaged_task_uninitialized() :
138 future_error{ std::make_error_code( future_errc::no_state) } {
139 }
140 };
141
142 }}
143
144 #ifdef BOOST_HAS_ABI_HEADERS
145 # include BOOST_ABI_SUFFIX
146 #endif
147
148 #endif // BOOST_fiber_errorS_H