1#ifndef NEFORCE_CORE_ASYNC_COROUTINE_HPP__
2#define NEFORCE_CORE_ASYNC_COROUTINE_HPP__
13#if defined(NEFORCE_STANDARD_20) || defined(NEXUSFORCE_ENABLE_DOXYGEN)
15NEFORCE_BEGIN_NAMESPACE__
31template <
typename Res,
typename... Args>
36template <
typename,
typename =
void>
37struct coroutine_traits_impl {};
39template <
typename Res>
40struct coroutine_traits_impl<Res,
void_t<typename Res::promise_type>> {
41 using promise_type =
typename Res::promise_type;
51template <
typename Res,
typename... Args>
63template <
typename Promise =
void>
77template <
typename Promise>
80 return reinterpret_cast<size_t>(
handle.address());
120 constexpr bool await_ready()
const noexcept {
return false; }
122 constexpr void await_resume()
const noexcept {}
133 constexpr bool await_ready()
const noexcept {
return true; }
135 constexpr void await_resume()
const noexcept {}
140NEFORCE_END_NAMESPACE__
noop_coroutine_handle noop_coroutine() noexcept
获取空操作协程句柄
std::coroutine_handle< Promise > coroutine_handle
协程句柄
std::noop_coroutine_handle noop_coroutine_promise
空操作协程的promise类型别名
coroutine_handle< noop_coroutine_promise > noop_coroutine_handle
空操作协程句柄类型别名
NEFORCE_ALWAYS_INLINE_INLINE thread::native_handle_type handle() noexcept
获取当前线程句柄