3 // Copyright (C) 2009-2014 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
29 struct future_error_category
: public std::error_category
35 virtual std::string
message(int __ec
) const
38 switch (std::future_errc(__ec
))
40 case std::future_errc::broken_promise
:
41 __msg
= "Broken promise";
43 case std::future_errc::future_already_retrieved
:
44 __msg
= "Future already retrieved";
46 case std::future_errc::promise_already_satisfied
:
47 __msg
= "Promise already satisfied";
49 case std::future_errc::no_state
:
50 __msg
= "No associated state";
53 __msg
= "Unknown error";
60 const future_error_category
&
61 __future_category_instance() noexcept
63 static const future_error_category __fec
{};
68 namespace std
_GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
72 const error_category
& future_category() noexcept
73 { return __future_category_instance(); }
75 future_error::~future_error() noexcept
{ }
78 future_error::what() const noexcept
{ return _M_code
.message().c_str(); }
80 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
81 && (ATOMIC_INT_LOCK_FREE > 1)
82 __future_base::_Result_base::_Result_base() = default;
84 __future_base::_Result_base::~_Result_base() = default;
87 _GLIBCXX_END_NAMESPACE_VERSION