]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fiber/include/boost/fiber/exceptions.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / exceptions.hpp
CommitLineData
7c673cae
FG
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
25namespace boost {
26namespace fibers {
27
28class fiber_error : public std::system_error {
29public:
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
45class lock_error : public fiber_error {
46public:
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
60enum class future_errc {
61 broken_promise = 1,
62 future_already_retrieved,
63 promise_already_satisfied,
64 no_state
65};
66
67BOOST_FIBERS_DECL
68std::error_category const& future_category() noexcept;
69
70}}
71
72namespace std {
73
74template<>
75struct is_error_code_enum< boost::fibers::future_errc > : public true_type {
76};
77
78inline
79std::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
83inline
84std::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
90namespace boost {
91namespace fibers {
92
93class future_error : public fiber_error {
94public:
95 future_error( std::error_code ec) :
96 fiber_error( ec) {
97 }
98};
99
100class future_uninitialized : public future_error {
101public:
102 future_uninitialized() :
103 future_error( std::make_error_code( future_errc::no_state) ) {
104 }
105};
106
107class future_already_retrieved : public future_error {
108public:
109 future_already_retrieved() :
110 future_error( std::make_error_code( future_errc::future_already_retrieved) ) {
111 }
112};
113
114class broken_promise : public future_error {
115public:
116 broken_promise() :
117 future_error( std::make_error_code( future_errc::broken_promise) ) {
118 }
119};
120
121class promise_already_satisfied : public future_error {
122public:
123 promise_already_satisfied() :
124 future_error( std::make_error_code( future_errc::promise_already_satisfied) ) {
125 }
126};
127
128class promise_uninitialized : public future_error {
129public:
130 promise_uninitialized() :
131 future_error( std::make_error_code( future_errc::no_state) ) {
132 }
133};
134
135class packaged_task_uninitialized : public future_error {
136public:
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