async: remove tag_invoke calls
P2300R9 removed usage of tag_invoke. stdexec still has it
but in order to be forward compliant with the C++26 standard
we should modernize the code and remove its usage. This also
has the benefit of simplifying most sender/receiver implementations.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib0a1d0a82485c8d247a18daa020d0bba2249e95c
diff --git a/src/async/context.cpp b/src/async/context.cpp
index d4ec5e9..0b31391 100644
--- a/src/async/context.cpp
+++ b/src/async/context.cpp
@@ -34,8 +34,7 @@
// Called by the `caller` to indicate the Sender should be stopped.
virtual void stop() noexcept = 0;
- // Arm the completion event.
- void arm() noexcept;
+ void start() noexcept;
// Data to share with the worker.
event_t::time_resolution timeout{};
@@ -70,32 +69,25 @@
execution::set_value(std::move(this->receiver));
}
- friend void tag_invoke(execution::start_t,
- wait_process_operation& self) noexcept
- {
- self.arm();
- }
-
R receiver;
};
/* The sender for the wait/process event. */
struct wait_process_sender : public context_ref
{
- using is_sender = void;
+ using sender_concept = execution::sender_t;
explicit wait_process_sender(context& ctx) : context_ref(ctx) {}
- friend auto tag_invoke(execution::get_completion_signatures_t,
- const wait_process_sender&, auto)
+ template <typename Self, class... Env>
+ static constexpr auto get_completion_signatures(Self&&, Env&&...)
-> execution::completion_signatures<execution::set_value_t()>;
template <execution::receiver R>
- friend auto tag_invoke(execution::connect_t, wait_process_sender&& self,
- R r) -> wait_process_operation<R>
+ auto connect(R r) -> wait_process_operation<R>
{
// Create the completion for the wait.
- return {self.ctx, std::move(r)};
+ return {ctx, std::move(r)};
}
};
@@ -282,7 +274,7 @@
}
}
-void details::wait_process_completion::arm() noexcept
+void details::wait_process_completion::start() noexcept
{
// Call process. True indicates something was handled and we do not
// need to `wait`, because there might be yet another pending operation