Skip to content

Commit 65779de

Browse files
committed
renamed async_scope_token -> scope_token
1 parent 97cf943 commit 65779de

File tree

8 files changed

+29
-32
lines changed

8 files changed

+29
-32
lines changed

include/beman/execution/detail/nest.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NEST
55
#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NEST
66

7-
#include <beman/execution/detail/async_scope_token.hpp>
7+
#include <beman/execution/detail/scope_token.hpp>
88
#include <beman/execution/detail/sender.hpp>
99

1010
// ----------------------------------------------------------------------------
1111

1212
namespace beman::execution {
1313
struct nest_t {
14-
template <::beman::execution::sender Sender, ::beman::execution::async_scope_token Token>
14+
template <::beman::execution::sender Sender, ::beman::execution::scope_token Token>
1515
auto operator()(Sender&&, Token&&) const {}
1616
};
1717
inline constexpr nest_t nest{};

include/beman/execution/detail/async_scope_token.hpp renamed to include/beman/execution/detail/scope_token.hpp

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

4-
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ASYNC_SCOPE_TOKEN
5-
#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ASYNC_SCOPE_TOKEN
4+
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN
5+
#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN
66

77
#include <beman/execution/detail/sender.hpp>
88
#include <beman/execution/detail/sender_in.hpp>
@@ -28,7 +28,7 @@ static_assert(::beman::execution::sender_in<::beman::execution::detail::token_te
2828

2929
namespace beman::execution {
3030
template <typename Token>
31-
concept async_scope_token = ::std::copyable<Token> && requires(Token token) {
31+
concept scope_token = ::std::copyable<Token> && requires(Token token) {
3232
{ token.try_associate() } -> ::std::same_as<bool>;
3333
{ token.disassociate() } noexcept;
3434
{

include/beman/execution/detail/spawn.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SPAWN
66

77
#include <beman/execution/detail/spawn_get_allocator.hpp>
8-
#include <beman/execution/detail/async_scope_token.hpp>
8+
#include <beman/execution/detail/scope_token.hpp>
99
#include <beman/execution/detail/empty_env.hpp>
1010
#include <beman/execution/detail/sender.hpp>
1111
#include <beman/execution/detail/receiver.hpp>
@@ -33,7 +33,7 @@ struct spawn_t {
3333
auto set_stopped() && noexcept -> void { this->state->complete(); }
3434
};
3535

36-
template <typename Alloc, ::beman::execution::async_scope_token Tok, ::beman::execution::sender Sndr>
36+
template <typename Alloc, ::beman::execution::scope_token Tok, ::beman::execution::sender Sndr>
3737
struct state : state_base {
3838
using op_t = ::beman::execution::connect_result_t<Sndr, receiver>;
3939
using alloc_t = typename ::std::allocator_traits<Alloc>::template rebind_alloc<state>;
@@ -63,7 +63,7 @@ struct spawn_t {
6363
Tok token;
6464
};
6565

66-
template <::beman::execution::sender Sender, ::beman::execution::async_scope_token Token, typename Env>
66+
template <::beman::execution::sender Sender, ::beman::execution::scope_token Token, typename Env>
6767
auto operator()(Sender&& sender, Token&& tok, Env&& env) const {
6868
auto new_sender{tok.wrap(::std::forward<Sender>(sender))};
6969
auto [all, senv] = ::beman::execution::detail::spawn_get_allocator(new_sender, env);
@@ -76,7 +76,7 @@ struct spawn_t {
7676
state_t* op{traits_t::allocate(alloc, 1u)};
7777
traits_t::construct(alloc, op, all, ::beman::execution::write_env(::std::move(new_sender), senv), tok);
7878
}
79-
template <::beman::execution::sender Sender, ::beman::execution::async_scope_token Token>
79+
template <::beman::execution::sender Sender, ::beman::execution::scope_token Token>
8080
auto operator()(Sender&& sender, Token&& token) const {
8181
return (*this)(::std::forward<Sender>(sender), ::std::forward<Token>(token), ::beman::execution::empty_env{});
8282
}

include/beman/execution/detail/spawn_future.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <beman/execution/detail/spawn_get_allocator.hpp>
88
#include <beman/execution/detail/as_tuple.hpp>
9-
#include <beman/execution/detail/async_scope_token.hpp>
9+
#include <beman/execution/detail/scope_token.hpp>
1010
#include <beman/execution/detail/completion_signatures_of_t.hpp>
1111
#include <beman/execution/detail/connect_result_t.hpp>
1212
#include <beman/execution/detail/default_impls.hpp>
@@ -111,10 +111,7 @@ using spawn_future_sigs = ::beman::execution::detail::meta::unique<::beman::exec
111111
::beman::execution::set_stopped_t(),
112112
::beman::execution::completion_signatures_of_t<::beman::execution::detail::future_spawned_sender<Sndr, Env>>>>;
113113

114-
template <typename Allocator,
115-
::beman::execution::async_scope_token Token,
116-
::beman::execution::sender Sndr,
117-
typename Env>
114+
template <typename Allocator, ::beman::execution::scope_token Token, ::beman::execution::sender Sndr, typename Env>
118115
struct spawn_future_state
119116
: ::beman::execution::detail::spawn_future_state_base<::beman::execution::detail::spawn_future_sigs<Sndr, Env>> {
120117
using alloc_t = typename ::std::allocator_traits<Allocator>::template rebind_alloc<spawn_future_state>;
@@ -219,7 +216,7 @@ struct spawn_future_state
219216

220217
class spawn_future_t {
221218
public:
222-
template <::beman::execution::sender Sndr, ::beman::execution::async_scope_token Tok, typename Ev>
219+
template <::beman::execution::sender Sndr, ::beman::execution::scope_token Tok, typename Ev>
223220
requires ::beman::execution::detail::queryable<::std::remove_cvref_t<Ev>>
224221
auto operator()(Sndr&& sndr, Tok&& tok, Ev&& ev) const {
225222
auto make{[&]() -> decltype(auto) { //-dk:TODO why decltype(auto) instead of auto?
@@ -244,7 +241,7 @@ class spawn_future_t {
244241
using deleter = decltype([](state_t* p) noexcept { p->abandon(); });
245242
return ::beman::execution::detail::make_sender(*this, ::std::unique_ptr<state_t, deleter>{op});
246243
}
247-
template <::beman::execution::sender Sndr, ::beman::execution::async_scope_token Tok>
244+
template <::beman::execution::sender Sndr, ::beman::execution::scope_token Tok>
248245
auto operator()(Sndr&& sndr, Tok&& tok) const {
249246
return (*this)(::std::forward<Sndr>(sndr), ::std::forward<Tok>(tok), ::beman::execution::empty_env{});
250247
}

src/beman/execution/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ target_sources(
4242
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/as_awaitable.hpp
4343
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/as_except_ptr.hpp
4444
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/as_tuple.hpp
45-
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/async_scope_token.hpp
4645
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/atomic_intrusive_stack.hpp
4746
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/await_result_type.hpp
4847
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/await_suspend_result.hpp
@@ -150,6 +149,7 @@ target_sources(
150149
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/schedule_result_t.hpp
151150
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/scheduler.hpp
152151
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/scheduler_t.hpp
152+
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/scope_token.hpp
153153
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/sender.hpp
154154
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/sender_adaptor.hpp
155155
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/sender_adaptor_closure.hpp

tests/beman/execution/exec-scope-concepts.test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// tests/beman/execution/exec-scope-concepts.test.cpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#include <beman/execution/detail/async_scope_token.hpp>
4+
#include <beman/execution/detail/scope_token.hpp>
55
#include <beman/execution/detail/sender.hpp>
66
#include <beman/execution/detail/sender_in.hpp>
77
#include <beman/execution/detail/completion_signatures.hpp>
@@ -57,10 +57,10 @@ struct token {
5757
} // namespace
5858

5959
TEST(exec_scope_concepts) {
60-
static_assert(test_std::async_scope_token<token<copyable, bool, true, wrap>>);
61-
static_assert(not test_std::async_scope_token<token<non_copyable, bool, true, wrap>>);
62-
static_assert(not test_std::async_scope_token<token<copyable, int, true, wrap>>);
63-
static_assert(not test_std::async_scope_token<token<copyable, bool, false, wrap>>);
64-
static_assert(not test_std::async_scope_token<token<copyable, bool, true, bad>>);
65-
static_assert(not test_std::async_scope_token<empty>);
60+
static_assert(test_std::scope_token<token<copyable, bool, true, wrap>>);
61+
static_assert(not test_std::scope_token<token<non_copyable, bool, true, wrap>>);
62+
static_assert(not test_std::scope_token<token<copyable, int, true, wrap>>);
63+
static_assert(not test_std::scope_token<token<copyable, bool, false, wrap>>);
64+
static_assert(not test_std::scope_token<token<copyable, bool, true, bad>>);
65+
static_assert(not test_std::scope_token<empty>);
6666
}

tests/beman/execution/exec-spawn-future.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <beman/execution/detail/spawn_get_allocator.hpp>
66
#include <beman/execution/detail/queryable.hpp>
77
#include <beman/execution/detail/sender.hpp>
8-
#include <beman/execution/detail/async_scope_token.hpp>
8+
#include <beman/execution/detail/scope_token.hpp>
99
#include <beman/execution/detail/receiver.hpp>
1010
#include <beman/execution/detail/simple_allocator.hpp>
1111
#include <beman/execution/detail/get_allocator.hpp>
@@ -74,8 +74,8 @@ struct token {
7474
return std::forward<Sender>(sender);
7575
}
7676
};
77-
static_assert(test_std::async_scope_token<token<true>>);
78-
static_assert(not test_std::async_scope_token<token<false>>);
77+
static_assert(test_std::scope_token<token<true>>);
78+
static_assert(not test_std::scope_token<token<false>>);
7979

8080
struct exception {
8181
int value;

tests/beman/execution/exec-spawn.test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <beman/execution/detail/spawn.hpp>
55
#include <beman/execution/detail/sender.hpp>
66
#include <beman/execution/detail/receiver.hpp>
7-
#include <beman/execution/detail/async_scope_token.hpp>
7+
#include <beman/execution/detail/scope_token.hpp>
88
#include <beman/execution/detail/set_value.hpp>
99
#include <beman/execution/detail/set_stopped.hpp>
1010
#include <test/execution.hpp>
@@ -60,8 +60,8 @@ struct token {
6060
return std::forward<Sndr>(sndr);
6161
}
6262
};
63-
static_assert(test_std::async_scope_token<token<true>>);
64-
static_assert(!test_std::async_scope_token<token<false>>);
63+
static_assert(test_std::scope_token<token<true>>);
64+
static_assert(!test_std::scope_token<token<false>>);
6565

6666
template <bool Expect, typename Sndr, typename Tok, typename Ev>
6767
auto test_overload(Sndr&& sndr, Tok&& tok, Ev ev) -> void {
@@ -113,7 +113,7 @@ auto test_spawn_receiver() -> void {
113113
}
114114
}
115115

116-
template <typename Alloc, test_std::async_scope_token Tok, test_std::sender Sndr>
116+
template <typename Alloc, test_std::scope_token Tok, test_std::sender Sndr>
117117
auto test_spawn_state(Alloc&& alloc, Tok&& tok, Sndr&& sndr) -> void {
118118
static_assert(requires(test_detail::spawn_t::state<Alloc, Tok, Sndr> state) {
119119
static_cast<test_detail::spawn_t::state_base&>(state);

0 commit comments

Comments
 (0)