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>
7
#ifndef BOOST_NO_EXCEPTIONS
10
#include <boost/thread/future_error_code.hpp>
15
namespace thread_detail
18
class future_error_category :
19
public boost::system::error_category
22
virtual const char* name() const BOOST_NOEXCEPT;
23
virtual std::string message(int ev) const;
27
future_error_category::name() const BOOST_NOEXCEPT
33
future_error_category::message(int ev) const
35
switch (BOOST_SCOPED_ENUM_NATIVE(future_errc)(ev))
37
case future_errc::broken_promise:
38
return std::string("The associated promise has been destructed prior "
39
"to the associated state becoming ready.");
40
case future_errc::future_already_retrieved:
41
return std::string("The future has already been retrieved from "
42
"the promise or packaged_task.");
43
case future_errc::promise_already_satisfied:
44
return std::string("The state of the promise has already been set.");
45
case future_errc::no_state:
46
return std::string("Operation not permitted on an object without "
47
"an associated state.");
49
return std::string("unspecified future_errc value\n");
51
future_error_category future_error_category_var;
55
const system::error_category&
56
future_category() BOOST_NOEXCEPT
58
return thread_detail::future_error_category_var;