diff --git a/include/beman/execution26/detail/sync_wait.hpp b/include/beman/execution26/detail/sync_wait.hpp index 694eb15a..b474d988 100644 --- a/include/beman/execution26/detail/sync_wait.hpp +++ b/include/beman/execution26/detail/sync_wait.hpp @@ -32,7 +32,7 @@ struct sync_wait_env { auto query(::beman::execution26::get_delegation_scheduler_t) const noexcept { return this->loop->get_scheduler(); } }; -template <::beman::execution26::sender_in Sender> +template <::beman::execution26::sender_in<::beman::execution26::detail::sync_wait_env> Sender> using sync_wait_result_type = ::std::optional<::beman::execution26::value_types_of_tstate->loop.finish(); } + auto get_env() const noexcept -> ::beman::execution26::detail::sync_wait_env { + return ::beman::execution26::detail::sync_wait_env{&this->state->loop}; + } }; struct sync_wait_t { diff --git a/tests/beman/execution26/exec-sync-wait.test.cpp b/tests/beman/execution26/exec-sync-wait.test.cpp index 5a650b42..f6fe31ee 100644 --- a/tests/beman/execution26/exec-sync-wait.test.cpp +++ b/tests/beman/execution26/exec-sync-wait.test.cpp @@ -13,6 +13,9 @@ #include #include #include +#include +#include +#include #include #include @@ -223,6 +226,15 @@ auto test_sync_wait() -> void { // NOLINTEND(cert-dcl03-c,hicpp-static-assert,misc-static-assert) } } + +auto test_provides_scheduler() -> void { + ASSERT(test_std::sync_wait(test_std::then(test_std::read_env(test_std::get_scheduler), [](auto&&) noexcept {}))); +} + +auto test_provides_delegation_scheduler() -> void { + ASSERT(test_std::sync_wait( + test_std::then(test_std::read_env(test_std::get_delegation_scheduler), [](auto&&) noexcept {}))); +} } // namespace TEST(exec_sync_wait) { @@ -236,4 +248,6 @@ TEST(exec_sync_wait) { test_sync_wait_state(); test_sync_wait_receiver(); test_sync_wait(); + test_provides_scheduler(); + test_provides_delegation_scheduler(); }