wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
detail.h
Go to the documentation of this file.
1#ifndef BF063C31_B18E_470A_8642_C43A4F1B49FC
2#define BF063C31_B18E_470A_8642_C43A4F1B49FC
3
13
14#include <coroutine>
15#include "exceptions.h"
16
18
19// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
20namespace wwa::coro { // NOSONAR
21
31namespace detail {
32
43constexpr bool is_good_handle(const std::coroutine_handle<>& h) noexcept
44{
45 return h && !h.done();
46}
47
59constexpr bool is_ready(const std::coroutine_handle<>& h) noexcept
60{
61 return !h || h.done();
62}
63
72inline void check_coroutine(const std::coroutine_handle<>& h)
73{
74 if (!h) {
75 throw bad_task("task is empty or destroyed");
76 }
77}
78
79} // namespace detail
80
81} // namespace wwa::coro
82
84
85#endif /* BF063C31_B18E_470A_8642_C43A4F1B49FC */
Custom exception classes for coroutine handling.
Library namespace.