From 6f5d2b537632839a5a5a8ea63e7fb8d15294c884 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Tue, 29 Dec 2015 14:17:03 +0100 Subject: [PATCH] nvalid_argument and fiber_resource_error rremoved --- include/boost/fiber/bounded_channel.hpp | 14 +++++------ include/boost/fiber/exceptions.hpp | 30 ----------------------- include/boost/fiber/unbounded_channel.hpp | 2 +- src/barrier.cpp | 4 +-- src/fiber.cpp | 6 ++--- 5 files changed, 13 insertions(+), 43 deletions(-) diff --git a/include/boost/fiber/bounded_channel.hpp b/include/boost/fiber/bounded_channel.hpp index d7e96576..ac22cbbb 100644 --- a/include/boost/fiber/bounded_channel.hpp +++ b/include/boost/fiber/bounded_channel.hpp @@ -206,12 +206,12 @@ public: hwm_{ hwm }, lwm_{ lwm } { if ( hwm_ <= lwm_) { - throw invalid_argument( std::make_error_code( std::errc::invalid_argument), - "boost fiber: high-watermark is less than or equal to low-watermark for bounded_channel"); + throw fiber_error( std::make_error_code( std::errc::invalid_argument), + "boost fiber: high-watermark is less than or equal to low-watermark for bounded_channel"); } if ( 0 == hwm) { - throw invalid_argument( std::make_error_code( std::errc::invalid_argument), - "boost fiber: high-watermark is zero"); + throw fiber_error( std::make_error_code( std::errc::invalid_argument), + "boost fiber: high-watermark is zero"); } } @@ -222,8 +222,8 @@ public: hwm_{ wm }, lwm_{ wm - 1 } { if ( 0 == wm) { - throw invalid_argument( std::make_error_code( std::errc::invalid_argument), - "boost fiber: watermark is zero"); + throw fiber_error( std::make_error_code( std::errc::invalid_argument), + "boost fiber: watermark is zero"); } } @@ -362,7 +362,7 @@ public: return is_closed_() || ! is_empty_(); }); if ( is_closed_() && is_empty_() ) { - throw fiber_resource_error( + throw fiber_error( std::make_error_code( std::errc::operation_not_permitted), "boost fiber: queue is closed"); } diff --git a/include/boost/fiber/exceptions.hpp b/include/boost/fiber/exceptions.hpp index bbcec5e2..267d076e 100644 --- a/include/boost/fiber/exceptions.hpp +++ b/include/boost/fiber/exceptions.hpp @@ -57,36 +57,6 @@ public: } }; -class fiber_resource_error : public fiber_error { -public: - fiber_resource_error( std::error_code ec) : - fiber_error( ec, "boost::fiber_resource_error") { - } - - fiber_resource_error( std::error_code ec, const char * what_arg) : - fiber_error( ec, what_arg) { - } - - fiber_resource_error( std::error_code ec, std::string const& what_arg) : - fiber_error( ec, what_arg) { - } -}; - -class invalid_argument : public fiber_error { -public: - invalid_argument( std::error_code ec) : - fiber_error( ec, "boost::invalid_argument") { - } - - invalid_argument( std::error_code ec, const char * what_arg) : - fiber_error( ec, what_arg) { - } - - invalid_argument( std::error_code ec, std::string const& what_arg) : - fiber_error( ec, what_arg) { - } -}; - class fiber_interrupted : public fiber_error { public: fiber_interrupted() : diff --git a/include/boost/fiber/unbounded_channel.hpp b/include/boost/fiber/unbounded_channel.hpp index 819c1145..b748aa06 100644 --- a/include/boost/fiber/unbounded_channel.hpp +++ b/include/boost/fiber/unbounded_channel.hpp @@ -203,7 +203,7 @@ public: return is_closed_() || ! is_empty_(); }); if ( is_closed_() && is_empty_() ) { - throw fiber_resource_error( + throw fiber_error( std::make_error_code( std::errc::operation_not_permitted), "boost fiber: queue is closed"); } diff --git a/src/barrier.cpp b/src/barrier.cpp index 88f18199..22a939e7 100644 --- a/src/barrier.cpp +++ b/src/barrier.cpp @@ -21,8 +21,8 @@ barrier::barrier( std::size_t initial) : initial_{ initial }, current_{ initial_ } { if ( 0 == initial) { - throw invalid_argument( std::make_error_code( std::errc::invalid_argument), - "boost fiber: zero initial barrier count"); + throw fiber_error( std::make_error_code( std::errc::invalid_argument), + "boost fiber: zero initial barrier count"); } } diff --git a/src/fiber.cpp b/src/fiber.cpp index b88d05a3..86f20571 100644 --- a/src/fiber.cpp +++ b/src/fiber.cpp @@ -31,11 +31,11 @@ void fiber::join() { // FIXME: must fiber::join() be synchronized? if ( context::active()->get_id() == get_id() ) { - throw fiber_resource_error( std::make_error_code( std::errc::resource_deadlock_would_occur), + throw fiber_error( std::make_error_code( std::errc::resource_deadlock_would_occur), "boost fiber: trying to join itself"); } if ( ! joinable() ) { - throw fiber_resource_error( std::make_error_code( std::errc::invalid_argument), + throw fiber_error( std::make_error_code( std::errc::invalid_argument), "boost fiber: fiber not joinable"); } @@ -53,7 +53,7 @@ fiber::interrupt() noexcept { void fiber::detach() { if ( ! joinable() ) { - throw fiber_resource_error( std::make_error_code( std::errc::invalid_argument), + throw fiber_error( std::make_error_code( std::errc::invalid_argument), "boost fiber: fiber not joinable"); } impl_.reset();