52 constexpr awaiter_type()
noexcept =
default;
53 constexpr awaiter_type(awaiter_type
const&)
noexcept =
default;
54 constexpr awaiter_type(awaiter_type&&)
noexcept =
default;
55 constexpr awaiter_type& operator=(awaiter_type
const&)
noexcept =
default;
56 constexpr awaiter_type& operator=(awaiter_type&&)
noexcept =
default;
60 [[nodiscard]]
constexpr bool await_ready()
noexcept
65 void await_suspend(std::coroutine_handle<> handle)
noexcept
67 hi_assert_not_null(_notifier);
71 _cbt = _notifier->subscribe(
72 [
this, handle](Args
const&...args) {
80 callback_flags::main | callback_flags::once);
83 constexpr void await_resume()
const noexcept requires(
sizeof...(Args) == 0) {}
85 constexpr auto await_resume()
const noexcept requires(
sizeof...(Args) == 1)
87 return std::get<0>(_args);
90 constexpr auto await_resume()
const noexcept requires(
sizeof...(Args) > 1)
128 auto token = std::make_shared<function_type>(hi_forward(callback));
130 hilet lock = std::scoped_lock(_mutex);
131 _callbacks.emplace_back(token, flags);
147 void operator()(Args const&...args) const noexcept
149 hilet lock = std::scoped_lock(_mutex);
151 for (
auto& callback : _callbacks) {
152 if (is_synchronous(callback.flags)) {
153 if (
auto func = callback.lock()) {
157 }
else if (is_local(callback.flags)) {
158 loop_local_post_function([=] {
159 if (
auto func = callback.lock()) {
164 }
else if (is_main(callback.flags)) {
165 loop_main_post_function([=] {
166 if (
auto func = callback.lock()) {
171 }
else if (is_timer(callback.flags)) {
172 loop_timer_post_function([=] {
173 if (
auto func = callback.lock()) {
186 if (is_once(callback.flags)) {