summaryrefslogtreecommitdiff
path: root/boost/fiber/exceptions.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:41:18 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:43:11 +0900
commitf763a99a501650eff2c60288aa6f10ef916d769e (patch)
tree02af7e13f9a38c888ebf340fe764cbe7dae99da9 /boost/fiber/exceptions.hpp
parent5cde13f21d36c7224b0e13d11c4b49379ae5210d (diff)
downloadboost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.gz
boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.bz2
boost-f763a99a501650eff2c60288aa6f10ef916d769e.zip
Imported Upstream version 1.62.0upstream/1.62.0
Change-Id: I9d4c1ddb7b7d8f0069217ecc582700f9fda6dd4c Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/fiber/exceptions.hpp')
-rw-r--r--boost/fiber/exceptions.hpp148
1 files changed, 148 insertions, 0 deletions
diff --git a/boost/fiber/exceptions.hpp b/boost/fiber/exceptions.hpp
new file mode 100644
index 0000000000..ddbf45eadf
--- /dev/null
+++ b/boost/fiber/exceptions.hpp
@@ -0,0 +1,148 @@
+//
+// Copyright Oliver Kowalke 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// based on boost.thread
+
+#ifndef BOOST_fiber_errorS_H
+#define BOOST_fiber_errorS_H
+
+#include <future>
+#include <stdexcept>
+#include <string>
+#include <system_error>
+
+#include <boost/config.hpp>
+
+#include <boost/fiber/detail/config.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace fibers {
+
+class fiber_error : public std::system_error {
+public:
+ fiber_error( std::error_code ec) :
+ std::system_error( ec) {
+ }
+
+ fiber_error( std::error_code ec, const char * what_arg) :
+ std::system_error( ec, what_arg) {
+ }
+
+ fiber_error( std::error_code ec, std::string const& what_arg) :
+ std::system_error( ec, what_arg) {
+ }
+
+ virtual ~fiber_error() = default;
+};
+
+class lock_error : public fiber_error {
+public:
+ lock_error( std::error_code ec) :
+ fiber_error( ec) {
+ }
+
+ lock_error( std::error_code ec, const char * what_arg) :
+ fiber_error( ec, what_arg) {
+ }
+
+ lock_error( std::error_code ec, std::string const& what_arg) :
+ fiber_error( ec, what_arg) {
+ }
+};
+
+enum class future_errc {
+ broken_promise = 1,
+ future_already_retrieved,
+ promise_already_satisfied,
+ no_state
+};
+
+BOOST_FIBERS_DECL
+std::error_category const& future_category() noexcept;
+
+}}
+
+namespace std {
+
+template<>
+struct is_error_code_enum< boost::fibers::future_errc > : public true_type {
+};
+
+inline
+std::error_code make_error_code( boost::fibers::future_errc e) noexcept {
+ return std::error_code( static_cast< int >( e), boost::fibers::future_category() );
+}
+
+inline
+std::error_condition make_error_condition( boost::fibers::future_errc e) noexcept {
+ return std::error_condition( static_cast< int >( e), boost::fibers::future_category() );
+}
+
+}
+
+namespace boost {
+namespace fibers {
+
+class future_error : public fiber_error {
+public:
+ future_error( std::error_code ec) :
+ fiber_error( ec) {
+ }
+};
+
+class future_uninitialized : public future_error {
+public:
+ future_uninitialized() :
+ future_error( std::make_error_code( future_errc::no_state) ) {
+ }
+};
+
+class future_already_retrieved : public future_error {
+public:
+ future_already_retrieved() :
+ future_error( std::make_error_code( future_errc::future_already_retrieved) ) {
+ }
+};
+
+class broken_promise : public future_error {
+public:
+ broken_promise() :
+ future_error( std::make_error_code( future_errc::broken_promise) ) {
+ }
+};
+
+class promise_already_satisfied : public future_error {
+public:
+ promise_already_satisfied() :
+ future_error( std::make_error_code( future_errc::promise_already_satisfied) ) {
+ }
+};
+
+class promise_uninitialized : public future_error {
+public:
+ promise_uninitialized() :
+ future_error( std::make_error_code( future_errc::no_state) ) {
+ }
+};
+
+class packaged_task_uninitialized : public future_error {
+public:
+ packaged_task_uninitialized() :
+ future_error( std::make_error_code( future_errc::no_state) ) {
+ }
+};
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_fiber_errorS_H