Skip to content

Commit b719b01

Browse files
committed
applied review feedback (partly from AI)
1 parent 050484a commit b719b01

File tree

6 files changed

+77
-17
lines changed

6 files changed

+77
-17
lines changed

include/beman/execution/detail/affine_on.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import beman.execution.detail.get_completion_signatures;
2424
import beman.execution.detail.get_domain_early;
2525
import beman.execution.detail.get_scheduler;
2626
import beman.execution.detail.get_stop_token;
27-
import beman.execution.detail.join_env;
2827
import beman.execution.detail.make_sender;
2928
import beman.execution.detail.never_stop_token;
3029
import beman.execution.detail.nested_sender_has_affine_on;
@@ -40,6 +39,7 @@ import beman.execution.detail.set_value;
4039
import beman.execution.detail.store_receiver;
4140
import beman.execution.detail.tag_of_t;
4241
import beman.execution.detail.transform_sender;
42+
import beman.execution.detail.unstoppable;
4343
import beman.execution.detail.write_env;
4444
#else
4545
#include <beman/execution/detail/env.hpp>
@@ -48,7 +48,6 @@ import beman.execution.detail.write_env;
4848
#include <beman/execution/detail/get_domain_early.hpp>
4949
#include <beman/execution/detail/get_scheduler.hpp>
5050
#include <beman/execution/detail/get_stop_token.hpp>
51-
#include <beman/execution/detail/join_env.hpp>
5251
#include <beman/execution/detail/make_sender.hpp>
5352
#include <beman/execution/detail/never_stop_token.hpp>
5453
#include <beman/execution/detail/prop.hpp>
@@ -62,6 +61,7 @@ import beman.execution.detail.write_env;
6261
#include <beman/execution/detail/store_receiver.hpp>
6362
#include <beman/execution/detail/tag_of_t.hpp>
6463
#include <beman/execution/detail/transform_sender.hpp>
64+
#include <beman/execution/detail/unstoppable.hpp>
6565
#include <beman/execution/detail/write_env.hpp>
6666
#endif
6767

@@ -139,13 +139,13 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure<affine_on_t> {
139139
static auto transform_sender(Sender&& sender, const Env& ev) {
140140
static_assert(requires {
141141
{
142-
::beman::execution::get_completion_signatures<
143-
decltype(::beman::execution::schedule(::beman::execution::get_scheduler(ev))),
144-
decltype(::beman::execution::detail::join_env(
145-
::beman::execution::env{::beman::execution::prop{
146-
::beman::execution::get_stop_token, ::beman::execution::never_stop_token{}, {}}},
147-
ev))>()
148-
} -> ::std::same_as<::beman::execution::completion_signatures<::beman::execution::set_value_t()>>;
142+
::beman::execution::get_completion_signatures<decltype(::beman::execution::unstoppable(
143+
::beman::execution::schedule(
144+
::beman::execution::get_scheduler(ev))),
145+
ev)>()
146+
} //-dk:TODO ->
147+
//::std::same_as<::beman::execution::completion_signatures<::beman::execution::set_value_t()>>
148+
;
149149
});
150150
//[[maybe_unused]] auto& [tag, data, child] = sender;
151151
auto& child = sender.template get<2>();
@@ -158,11 +158,9 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure<affine_on_t> {
158158
return ::beman::execution::detail::store_receiver(
159159
::beman::execution::detail::forward_like<Sender>(child),
160160
[]<typename Child>(Child&& child, const auto& ev) {
161-
return ::beman::execution::write_env(
162-
::beman::execution::schedule_from(
163-
::beman::execution::get_scheduler(ev),
164-
::beman::execution::write_env(::std::forward<Child>(child), ev)),
165-
::beman::execution::detail::affine_on_env(ev));
161+
return ::beman::execution::unstoppable(::beman::execution::schedule_from(
162+
::beman::execution::get_scheduler(ev),
163+
::beman::execution::write_env(::std::forward<Child>(child), ev)));
166164
});
167165
}
168166
}

include/beman/execution/detail/store_receiver.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// include/beman/execution/detail/store_receiver.hpp -*-C++-*-
1+
//-dk:TODO rRW/// include/beman/execution/detail/store_receiver.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

44
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_STORE_RECEIVER
@@ -70,7 +70,7 @@ struct store_receiver_t {
7070
state_t op_state;
7171
template <::beman::execution::sender S, typename T, ::beman::execution::receiver R>
7272
state(S&& sndr, T&& trans, R&& r)
73-
: rcvr(::std::forward<Rcvr>(::std::forward<R>(r))),
73+
: rcvr(::std::forward<R>(r)),
7474
op_state(::beman::execution::connect(
7575
::std::forward<T>(trans)(::std::forward<S>(sndr), ::beman::execution::get_env(this->rcvr)),
7676
receiver<Rcvr>{::std::addressof(this->rcvr)})) {}
@@ -81,7 +81,8 @@ struct store_receiver_t {
8181
using sender_concept = ::beman::execution::sender_t;
8282
template <typename... Env>
8383
static consteval auto get_completion_signatures(Env&&... env) noexcept {
84-
return ::beman::execution::get_completion_signatures<::std::remove_cvref_t<Sndr>, Env...>();
84+
return ::beman::execution::
85+
get_completion_signatures<decltype(::std::declval<Trans>()(::std::declval<Sndr>())), Env...>();
8586
}
8687
::std::remove_cvref_t<Sndr> sndr;
8788
::std::remove_cvref_t<Trans> trans;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// include/beman/execution/detail/unstoppable.hpp -*-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_UNSTOPPABLE
5+
#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_UNSTOPPABLE
6+
7+
#include <beman/execution/detail/common.hpp>
8+
#ifdef BEMAN_HAS_IMPORT_STD
9+
import std;
10+
#else
11+
#include <utility>
12+
#endif
13+
#ifdef BEMAN_HAS_MODULES
14+
import beman.execution.detail.get_stop_token;
15+
import beman.execution.detail.never_stop_token;
16+
import beman.execution.detail.prop;
17+
import beman.execution.detail.sender;
18+
import beman.execution.detail.write_env;
19+
#else
20+
#include <beman/execution/detail/get_stop_token.hpp>
21+
#include <beman/execution/detail/never_stop_token.hpp>
22+
#include <beman/execution/detail/prop.hpp>
23+
#include <beman/execution/detail/sender.hpp>
24+
#include <beman/execution/detail/write_env.hpp>
25+
#endif
26+
27+
// ----------------------------------------------------------------------------
28+
29+
namespace beman::execution::detail {
30+
struct unstoppable_t {
31+
template <::beman::execution::sender Sndr>
32+
auto operator()(Sndr&& sndr) const {
33+
return ::beman::execution::write_env(
34+
::std::forward<Sndr>(sndr),
35+
::beman::execution::prop{::beman::execution::get_stop_token, ::beman::execution::never_stop_token{}, {}});
36+
}
37+
};
38+
} // namespace beman::execution::detail
39+
40+
namespace beman::execution {
41+
using unstoppable_t = ::beman::execution::detail::unstoppable_t;
42+
inline constexpr ::beman::execution::unstoppable_t unstoppable{};
43+
} // namespace beman::execution
44+
45+
// ----------------------------------------------------------------------------
46+
47+
#endif

src/beman/execution/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ target_sources(
187187
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/transform_sender.hpp
188188
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/type_list.hpp
189189
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/unspecified_promise.hpp
190+
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/unstoppable.hpp
190191
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/unstoppable_token.hpp
191192
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/valid_completion_for.hpp
192193
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/valid_completion_signatures.hpp
@@ -374,6 +375,7 @@ if(BEMAN_USE_MODULES)
374375
transform_sender.cppm
375376
type_list.cppm
376377
unspecified_promise.cppm
378+
unstoppable.cppm
377379
unstoppable_token.cppm
378380
valid_completion_for.cppm
379381
valid_completion_signatures.cppm

src/beman/execution/execution.cppm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import beman.execution.detail.inline_scheduler;
8181

8282
// [stoptoken.concepts], stop token concepts
8383
export import beman.execution.detail.stoppable_token;
84+
export import beman.execution.detail.unstoppable;
8485
export import beman.execution.detail.unstoppable_token;
8586

8687
// [exec.recv], receivers
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module;
2+
// src/beman/execution/unstoppable.cppm -*-C++-*-
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#include <beman/execution/detail/unstoppable.hpp>
6+
7+
export module beman.execution.detail.unstoppable;
8+
9+
namespace beman::execution {
10+
export using beman::execution::unstoppable;
11+
} // namespace beman::execution

0 commit comments

Comments
 (0)