From 03145f025c5a45e905649b4541066ba6747a8fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Thu, 9 Jan 2025 00:00:48 +0000 Subject: [PATCH 1/3] fixed a few coroutine related issues --- include/beman/execution26/detail/product_type.hpp | 4 ++++ include/beman/execution26/detail/sender_awaitable.hpp | 3 ++- .../beman/execution26/detail/single_sender_value_type.hpp | 2 ++ tests/beman/execution26/execution-syn.test.cpp | 8 ++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/beman/execution26/detail/product_type.hpp b/include/beman/execution26/detail/product_type.hpp index fdfaec3b..b309f95c 100644 --- a/include/beman/execution26/detail/product_type.hpp +++ b/include/beman/execution26/detail/product_type.hpp @@ -7,6 +7,8 @@ #include #include +#include + // ---------------------------------------------------------------------------- namespace beman::execution26::detail { @@ -126,4 +128,6 @@ struct tuple_element { // ---------------------------------------------------------------------------- +#include + #endif diff --git a/include/beman/execution26/detail/sender_awaitable.hpp b/include/beman/execution26/detail/sender_awaitable.hpp index f414a57c..147ee7e4 100644 --- a/include/beman/execution26/detail/sender_awaitable.hpp +++ b/include/beman/execution26/detail/sender_awaitable.hpp @@ -53,7 +53,8 @@ class sender_awaitable { } void set_stopped() && noexcept { - static_cast<::std::coroutine_handle<>>(continuation_.promise().unhandled_stopped()).resume(); + auto handle = static_cast<::std::coroutine_handle<>>(continuation_.promise().unhandled_stopped()); + if (handle) handle.resume(); } auto get_env() const noexcept { diff --git a/include/beman/execution26/detail/single_sender_value_type.hpp b/include/beman/execution26/detail/single_sender_value_type.hpp index e8bb5501..bb7faa24 100644 --- a/include/beman/execution26/detail/single_sender_value_type.hpp +++ b/include/beman/execution26/detail/single_sender_value_type.hpp @@ -28,6 +28,8 @@ struct single_sender_value_type_helper { template requires ::std::same_as<::std::variant<::std::tuple<>>, ::beman::execution26::value_types_of_t> + || ::std::same_as<::std::variant<>, + ::beman::execution26::value_types_of_t> struct single_sender_value_type_helper { using type = void; }; diff --git a/tests/beman/execution26/execution-syn.test.cpp b/tests/beman/execution26/execution-syn.test.cpp index 06f5e6b6..8c00562b 100644 --- a/tests/beman/execution26/execution-syn.test.cpp +++ b/tests/beman/execution26/execution-syn.test.cpp @@ -225,18 +225,18 @@ auto test_single_sender_value_type() -> void { test_detail::single_sender_value_type>); test_single_sender_value_type(single_type_sender{}, test_std::empty_env{}); test_single_sender_value_type(single_type_sender{}, test_env{}); - test_single_sender_value_type(single_type_sender{}, no_value_env{}); + test_single_sender_value_type(single_type_sender{}, no_value_env{}); test_single_sender_value_type(multi_single_sender{}, test_std::empty_env{}); - test_single_sender_value_type(no_value_sender{}, test_std::empty_env{}); + test_single_sender_value_type(no_value_sender{}, test_std::empty_env{}); } auto test_single_sender() -> void { static_assert(test_detail::single_sender); - static_assert(not test_detail::single_sender); + static_assert(test_detail::single_sender); static_assert(test_detail::single_sender); static_assert(not test_detail::single_sender); static_assert(test_detail::single_sender); - static_assert(not test_detail::single_sender); + static_assert(test_detail::single_sender); } struct connect_sender { From 126405c1d6bf5249405fe958c24a9055b5b506ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Thu, 9 Jan 2025 00:22:23 +0000 Subject: [PATCH 2/3] fixed formatting issues --- include/beman/execution26/detail/sender_awaitable.hpp | 3 ++- include/beman/execution26/detail/single_sender_value_type.hpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/beman/execution26/detail/sender_awaitable.hpp b/include/beman/execution26/detail/sender_awaitable.hpp index 147ee7e4..dae31ff5 100644 --- a/include/beman/execution26/detail/sender_awaitable.hpp +++ b/include/beman/execution26/detail/sender_awaitable.hpp @@ -54,7 +54,8 @@ class sender_awaitable { void set_stopped() && noexcept { auto handle = static_cast<::std::coroutine_handle<>>(continuation_.promise().unhandled_stopped()); - if (handle) handle.resume(); + if (handle) + handle.resume(); } auto get_env() const noexcept { diff --git a/include/beman/execution26/detail/single_sender_value_type.hpp b/include/beman/execution26/detail/single_sender_value_type.hpp index bb7faa24..a1055426 100644 --- a/include/beman/execution26/detail/single_sender_value_type.hpp +++ b/include/beman/execution26/detail/single_sender_value_type.hpp @@ -27,8 +27,8 @@ struct single_sender_value_type_helper { template requires ::std::same_as<::std::variant<::std::tuple<>>, - ::beman::execution26::value_types_of_t> - || ::std::same_as<::std::variant<>, + ::beman::execution26::value_types_of_t> || + ::std::same_as<::std::variant<>, ::beman::execution26::value_types_of_t> struct single_sender_value_type_helper { using type = void; From 084acb063f17fad095a231874f1dcfd4933b7f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Thu, 9 Jan 2025 07:12:14 +0000 Subject: [PATCH 3/3] reverted te chnage checking the result from unhandled_stopped(). --- include/beman/execution26/detail/sender_awaitable.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/beman/execution26/detail/sender_awaitable.hpp b/include/beman/execution26/detail/sender_awaitable.hpp index dae31ff5..f414a57c 100644 --- a/include/beman/execution26/detail/sender_awaitable.hpp +++ b/include/beman/execution26/detail/sender_awaitable.hpp @@ -53,9 +53,7 @@ class sender_awaitable { } void set_stopped() && noexcept { - auto handle = static_cast<::std::coroutine_handle<>>(continuation_.promise().unhandled_stopped()); - if (handle) - handle.resume(); + static_cast<::std::coroutine_handle<>>(continuation_.promise().unhandled_stopped()).resume(); } auto get_env() const noexcept {