diff --git a/source/mijin/async/coroutine.hpp b/source/mijin/async/coroutine.hpp index 068b3a3..933fa02 100644 --- a/source/mijin/async/coroutine.hpp +++ b/source/mijin/async/coroutine.hpp @@ -49,10 +49,10 @@ class TaskLoop; template class TaskBase; -namespace impl -{ struct TaskCancelled : std::exception {}; +namespace impl +{ inline void throwIfCancelled(); } // namespace impl @@ -126,7 +126,7 @@ struct TaskAwaitableFuture [[nodiscard]] constexpr bool await_ready() const noexcept { return future->ready(); } constexpr void await_suspend(std::coroutine_handle<>) const noexcept {} - constexpr TValue await_resume() const noexcept + constexpr TValue await_resume() const { impl::throwIfCancelled(); if constexpr (std::is_same_v) { @@ -606,7 +606,7 @@ inline TaskStatus TaskLoop::tickTask(StoredTask& task) { std::rethrow_exception(task.task->exception()); } - catch(impl::TaskCancelled&) {} // ignore those + catch(TaskCancelled&) {} // ignore those catch(...) { if (uncaughtExceptionHandler_)