1 // (C) Copyright 2012 Vicente J. Botet Escriba
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/thread/detail/config.hpp>
8 #ifndef BOOST_NO_EXCEPTIONS
10 #include <boost/thread/futures/future_error_code.hpp>
16 namespace thread_detail
19 class future_error_category
:
20 public boost::system::error_category
23 virtual const char* name() const BOOST_NOEXCEPT
;
24 virtual std::string
message(int ev
) const;
28 future_error_category::name() const BOOST_NOEXCEPT
34 future_error_category::message(int ev
) const
36 switch (BOOST_SCOPED_ENUM_NATIVE(future_errc
)(ev
))
38 case future_errc::broken_promise
:
39 return std::string("The associated promise has been destructed prior "
40 "to the associated state becoming ready.");
41 case future_errc::future_already_retrieved
:
42 return std::string("The future has already been retrieved from "
43 "the promise or packaged_task.");
44 case future_errc::promise_already_satisfied
:
45 return std::string("The state of the promise has already been set.");
46 case future_errc::no_state
:
47 return std::string("Operation not permitted on an object without "
48 "an associated state.");
50 return std::string("unspecified future_errc value\n");
52 future_error_category future_error_category_var
;
56 const system::error_category
&
57 future_category() BOOST_NOEXCEPT
59 return thread_detail::future_error_category_var
;