mirror of
https://github.com/boostorg/fiber.git
synced 2026-02-19 02:12:24 +00:00
nvalid_argument and fiber_resource_error rremoved
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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() :
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user