Make make_cancelling_continuable throw an default constructed exception_t

* This behaviour now aligns on how cancellation is handled in the
  unhandled exception handler
This commit is contained in:
Denis Blank 2020-04-03 19:44:49 +02:00
parent ca26bbbc87
commit 85c0d76c7c

View File

@ -932,7 +932,8 @@ constexpr auto make_exceptional_continuable(Exception&& exception) {
} }
/// Returns a continuable_base with the parameterized result which never /// Returns a continuable_base with the parameterized result which never
/// resolves its promise and thus cancels the asynchronous continuation chain. /// resolves its promise and thus cancels the asynchronous continuation chain
/// through throwing a default constructed exception_t.
/// ///
/// This can be used to cancel an asynchronous continuation chain when /// This can be used to cancel an asynchronous continuation chain when
/// returning a continuable_base from a handler where other paths could /// returning a continuable_base from a handler where other paths could
@ -948,6 +949,10 @@ constexpr auto make_exceptional_continuable(Exception&& exception) {
/// } /// }
/// }); /// });
/// ``` /// ```
/// The default unhandled exception handler ignores exception types
/// that don't evaluate to true when being converted to a bool.
/// This saves expensive construction of std::exception_ptr or similar types,
/// where only one exception type is used for signaling the cancellation.
/// ///
/// \tparam Signature The fake signature of the returned continuable. /// \tparam Signature The fake signature of the returned continuable.
/// ///
@ -957,7 +962,7 @@ auto make_cancelling_continuable() {
static_assert(sizeof...(Signature) > 0, static_assert(sizeof...(Signature) > 0,
"Requires at least one type for the fake signature!"); "Requires at least one type for the fake signature!");
return make_continuable<Signature...>([](auto&&) { /* ... */ }); return make_exceptional_continuable<Signature...>(exception_t{});
} }
/// Can be used to disable the special meaning for a returned value in /// Can be used to disable the special meaning for a returned value in