Moved TaskCancelled out of impl namespace and removed errornous noexcept.

This commit is contained in:
2023-11-16 00:34:36 +01:00
parent ef6830e01c
commit 5eb7864928

View File

@@ -49,10 +49,10 @@ class TaskLoop;
template<typename TResult = void> template<typename TResult = void>
class TaskBase; class TaskBase;
namespace impl
{
struct TaskCancelled : std::exception {}; struct TaskCancelled : std::exception {};
namespace impl
{
inline void throwIfCancelled(); inline void throwIfCancelled();
} // namespace impl } // namespace impl
@@ -126,7 +126,7 @@ struct TaskAwaitableFuture
[[nodiscard]] constexpr bool await_ready() const noexcept { return future->ready(); } [[nodiscard]] constexpr bool await_ready() const noexcept { return future->ready(); }
constexpr void await_suspend(std::coroutine_handle<>) const noexcept {} constexpr void await_suspend(std::coroutine_handle<>) const noexcept {}
constexpr TValue await_resume() const noexcept constexpr TValue await_resume() const
{ {
impl::throwIfCancelled(); impl::throwIfCancelled();
if constexpr (std::is_same_v<TValue, void>) { if constexpr (std::is_same_v<TValue, void>) {
@@ -606,7 +606,7 @@ inline TaskStatus TaskLoop::tickTask(StoredTask& task)
{ {
std::rethrow_exception(task.task->exception()); std::rethrow_exception(task.task->exception());
} }
catch(impl::TaskCancelled&) {} // ignore those catch(TaskCancelled&) {} // ignore those
catch(...) catch(...)
{ {
if (uncaughtExceptionHandler_) if (uncaughtExceptionHandler_)