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)
7 // based on boost.thread
9 #ifndef BOOST_fiber_errorS_H
10 #define BOOST_fiber_errorS_H
15 #include <system_error>
17 #include <boost/config.hpp>
19 #include <boost/fiber/detail/config.hpp>
21 #ifdef BOOST_HAS_ABI_HEADERS
22 # include BOOST_ABI_PREFIX
28 class fiber_error : public std::system_error {
30 fiber_error( std::error_code ec) :
31 std::system_error( ec) {
34 fiber_error( std::error_code ec, const char * what_arg) :
35 std::system_error( ec, what_arg) {
38 fiber_error( std::error_code ec, std::string const& what_arg) :
39 std::system_error( ec, what_arg) {
42 virtual ~fiber_error() = default;
45 class lock_error : public fiber_error {
47 lock_error( std::error_code ec) :
51 lock_error( std::error_code ec, const char * what_arg) :
52 fiber_error( ec, what_arg) {
55 lock_error( std::error_code ec, std::string const& what_arg) :
56 fiber_error( ec, what_arg) {
60 enum class future_errc {
62 future_already_retrieved,
63 promise_already_satisfied,
68 std::error_category const& future_category() noexcept;
75 struct is_error_code_enum< boost::fibers::future_errc > : public true_type {
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() );
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() );
93 class future_error : public fiber_error {
95 future_error( std::error_code ec) :
100 class future_uninitialized : public future_error {
102 future_uninitialized() :
103 future_error( std::make_error_code( future_errc::no_state) ) {
107 class future_already_retrieved : public future_error {
109 future_already_retrieved() :
110 future_error( std::make_error_code( future_errc::future_already_retrieved) ) {
114 class broken_promise : public future_error {
117 future_error( std::make_error_code( future_errc::broken_promise) ) {
121 class promise_already_satisfied : public future_error {
123 promise_already_satisfied() :
124 future_error( std::make_error_code( future_errc::promise_already_satisfied) ) {
128 class promise_uninitialized : public future_error {
130 promise_uninitialized() :
131 future_error( std::make_error_code( future_errc::no_state) ) {
135 class packaged_task_uninitialized : public future_error {
137 packaged_task_uninitialized() :
138 future_error( std::make_error_code( future_errc::no_state) ) {
144 #ifdef BOOST_HAS_ABI_HEADERS
145 # include BOOST_ABI_SUFFIX
148 #endif // BOOST_fiber_errorS_H