Commit f6f9c8be authored by Xavier Thompson's avatar Xavier Thompson

WIP Minor task.hpp changes

parent f8b93d31
......@@ -23,18 +23,8 @@ namespace typon
struct promise_type : result<T>
{
std::coroutine_handle<> _continuation;
struct final_awaitable : std::suspend_always
{
template <typename Promise>
std::coroutine_handle<> await_suspend(std::coroutine_handle<Promise> coroutine) noexcept
{
return coroutine.promise()._continuation;
}
};
task get_return_object() noexcept
{
return { std::coroutine_handle<promise_type>::from_promise(*this) };
......@@ -45,9 +35,17 @@ namespace typon
return {};
}
final_awaitable final_suspend() noexcept
auto final_suspend() noexcept
{
return {};
struct awaitable : std::suspend_always
{
std::coroutine_handle<> await_suspend(std::coroutine_handle<promise_type> coroutine) noexcept
{
return coroutine.promise()._continuation;
}
};
return awaitable {};
}
};
......@@ -57,7 +55,10 @@ namespace typon
{
std::coroutine_handle<promise_type> _coroutine;
bool await_ready() { return false; };
bool await_ready() noexcept
{
return false;
}
std::coroutine_handle<> await_suspend(std::coroutine_handle<> awaiting_coroutine) noexcept
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment