Skip to content

Commit 50c738d

Browse files
authored
Merge branch 'main' into unused-parameter
2 parents cabe229 + 730b263 commit 50c738d

4 files changed

Lines changed: 30 additions & 42 deletions

File tree

include/exec/at_coroutine_exit.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ namespace exec {
119119
inline constexpr __die_on_stop_t __die_on_stop;
120120

121121
template <class _Promise>
122-
concept __has_continuation = requires(_Promise& __promise, __continuation_handle<> __c) {
123-
{ __promise.continuation() } -> convertible_to<__continuation_handle<>>;
122+
concept __has_continuation = requires(_Promise& __promise, __coroutine_handle<> __c) {
123+
{ __promise.continuation() } -> convertible_to<__coroutine_handle<>>;
124124
{ __promise.set_continuation(__c) };
125125
};
126126

include/exec/on_coro_disposition.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "../stdexec/execution.hpp"
2222
#include "../stdexec/coroutine.hpp"
2323
#include "task.hpp"
24-
#include "inline_scheduler.hpp"
24+
#include "inline_scheduler.hpp" // IWYU pragma: keep
2525
#include "any_sender_of.hpp"
2626

2727
#include <exception>

include/exec/task.hpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -494,22 +494,6 @@ namespace exec {
494494
return __task_awaitable<>{std::exchange(__coro_, {})};
495495
}
496496

497-
// From the list of types [_Ty], remove any types that are void, and send
498-
// the resulting list to __qf<set_value_t>, which uses the list of types
499-
// as arguments of a function type. In other words, set_value_t() if _Ty
500-
// is void, and set_value_t(_Ty) otherwise.
501-
using __set_value_sig_t = __minvoke<__mremove<void, __qf<set_value_t>>, _Ty>;
502-
503-
// Specify basic_task's completion signatures
504-
// This is only necessary when basic_task is not generally awaitable
505-
// owing to constraints imposed by its _Context parameter.
506-
using __task_traits_t =
507-
completion_signatures<__set_value_sig_t, set_error_t(std::exception_ptr), set_stopped_t()>;
508-
509-
auto get_completion_signatures(__ignore = {}) const -> __task_traits_t {
510-
return {};
511-
}
512-
513497
explicit basic_task(__coro::coroutine_handle<promise_type> __coro) noexcept
514498
: __coro_(__coro) {
515499
}

include/stdexec/__detail/__with_awaitable_senders.hpp

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@
1919

2020
#include "__as_awaitable.hpp"
2121
#include "__concepts.hpp"
22+
#include "../coroutine.hpp" // IWYU pragma: keep for __coro::coroutine_handle
2223

2324
#include <exception>
2425

2526
namespace stdexec {
2627
#if !STDEXEC_STD_NO_COROUTINES()
2728
namespace __was {
2829
template <class _Promise = void>
29-
class __continuation_handle;
30+
class __coroutine_handle;
3031

3132
template <>
32-
class __continuation_handle<void> {
33+
class __coroutine_handle<void> : __coro::coroutine_handle<> {
3334
public:
34-
__continuation_handle() = default;
35+
__coroutine_handle() = default;
3536

3637
template <class _Promise>
37-
__continuation_handle(__coro::coroutine_handle<_Promise> __coro) noexcept
38-
: __coro_(__coro) {
38+
__coroutine_handle(__coro::coroutine_handle<_Promise> __coro) noexcept
39+
: __coro::coroutine_handle<>(__coro) {
3940
if constexpr (requires(_Promise& __promise) { __promise.unhandled_stopped(); }) {
4041
__stopped_callback_ = [](void* __address) noexcept -> __coro::coroutine_handle<> {
4142
// This causes the rest of the coroutine (the part after the co_await
@@ -53,43 +54,46 @@ namespace stdexec {
5354

5455
[[nodiscard]]
5556
auto handle() const noexcept -> __coro::coroutine_handle<> {
56-
return __coro_;
57+
return *this;
5758
}
5859

5960
[[nodiscard]]
6061
auto unhandled_stopped() const noexcept -> __coro::coroutine_handle<> {
61-
return __stopped_callback_(__coro_.address());
62+
return __stopped_callback_(address());
6263
}
6364

6465
private:
6566
using __stopped_callback_t = __coro::coroutine_handle<> (*)(void*) noexcept;
6667

67-
__coro::coroutine_handle<> __coro_{};
6868
__stopped_callback_t __stopped_callback_ = [](void*) noexcept -> __coro::coroutine_handle<> {
6969
std::terminate();
7070
};
7171
};
7272

7373
template <class _Promise>
74-
class __continuation_handle {
74+
class __coroutine_handle : public __coroutine_handle<> {
7575
public:
76-
__continuation_handle() = default;
76+
__coroutine_handle() = default;
7777

78-
__continuation_handle(__coro::coroutine_handle<_Promise> __coro) noexcept
79-
: __continuation_{__coro} {
78+
__coroutine_handle(__coro::coroutine_handle<_Promise> __coro) noexcept
79+
: __coroutine_handle<>{__coro} {
8080
}
8181

82-
auto handle() const noexcept -> __coro::coroutine_handle<_Promise> {
83-
return __coro::coroutine_handle<_Promise>::from_address(__continuation_.handle().address());
82+
static auto from_promise(_Promise& __promise) noexcept -> __coroutine_handle {
83+
return __coroutine_handle(__coro::coroutine_handle<_Promise>::from_promise(__promise));
8484
}
8585

86-
[[nodiscard]]
87-
auto unhandled_stopped() const noexcept -> __coro::coroutine_handle<> {
88-
return __continuation_.unhandled_stopped();
86+
auto promise() const noexcept -> _Promise& {
87+
return __coro::coroutine_handle<_Promise>::from_address(address()).promise();
8988
}
9089

91-
private:
92-
__continuation_handle<> __continuation_{};
90+
auto handle() const noexcept -> __coro::coroutine_handle<_Promise> {
91+
return __coro::coroutine_handle<_Promise>::from_address(address());
92+
}
93+
94+
operator __coro::coroutine_handle<_Promise>() const noexcept {
95+
return handle();
96+
}
9397
};
9498

9599
struct __with_awaitable_senders_base {
@@ -99,12 +103,12 @@ namespace stdexec {
99103
__continuation_ = __hcoro;
100104
}
101105

102-
void set_continuation(__continuation_handle<> __continuation) noexcept {
106+
void set_continuation(__coroutine_handle<> __continuation) noexcept {
103107
__continuation_ = __continuation;
104108
}
105109

106110
[[nodiscard]]
107-
auto continuation() const noexcept -> __continuation_handle<> {
111+
auto continuation() const noexcept -> __coroutine_handle<> {
108112
return __continuation_;
109113
}
110114

@@ -113,7 +117,7 @@ namespace stdexec {
113117
}
114118

115119
private:
116-
__continuation_handle<> __continuation_{};
120+
__coroutine_handle<> __continuation_{};
117121
};
118122

119123
template <class _Promise>
@@ -127,6 +131,6 @@ namespace stdexec {
127131
} // namespace __was
128132

129133
using __was::with_awaitable_senders;
130-
using __was::__continuation_handle;
134+
using __was::__coroutine_handle;
131135
#endif
132136
} // namespace stdexec

0 commit comments

Comments
 (0)