From 77cf6eadea0de721b42f1903f2912e8ee875e2a6 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 20 Mar 2024 12:41:41 -0700 Subject: [PATCH] add explicit opt-in for operation_state concept --- execution.bs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/execution.bs b/execution.bs index cb1700d..678c098 100644 --- a/execution.bs +++ b/execution.bs @@ -427,6 +427,8 @@ struct operation_base : WSAOVERALAPPED { template struct recv_op : operation_base { + using operation_state_concept = std::execution::operation_state_t; + recv_op(SOCKET s, void* data, size_t len, Receiver r) : receiver(std::move(r)) , sock(s) { @@ -772,6 +774,7 @@ struct _retry_receiver // re-construct and re-start it if the operation fails. template struct _retry_op { + using operation_state_concept = stdexec::operation_state_t; using _child_op_t = stdexec::connect_result_t>; @@ -899,7 +902,9 @@ namespace stdexec = std::execution; class inline_scheduler { template struct _op { + using operation_state_concept = operation_state_t; R rec_; + void start() & noexcept { stdexec::set_value(std::move(rec_)); } @@ -4871,6 +4876,8 @@ namespace std::execution { inline constexpr set_stopped_t set_stopped{}; // [exec.opstate], operation states + struct operation_state_t {}; + template<class O> concept operation_state = see below; @@ -5456,8 +5463,15 @@ enum class forward_progress_guarantee { type ([async.ops]).
+    template<class Rcvr>
+      concept enable-opstate = // exposition only
+        requires {
+          requires derived_from<typename Rcvr::operation_state_concept, operation_state_t>;
+        };
+
     template<class O>
       concept operation_state =
+        enable-opstate<remove_cvref_t<O>> &&
         queryable<O> &&
         is_object_v<O> &&
         requires (O& o) {
@@ -5815,6 +5829,7 @@ enum class forward_progress_guarantee {
                 requires well-formed<state-type, Sndr, Rcvr> &&
                   well-formed<inner-ops-tuple, Sndr, Rcvr>
               struct basic-operation {  // exposition only
+                using operation_state_concept = operation_state_t;
                 using tag-type = tag_of_t<Sndr>; // exposition only
 
                 Rcvr rcvr_; // exposition only
@@ -6378,6 +6393,7 @@ template<class Domain, class Tag, sender Sndr, class... Args>
 
     
     struct operation-state-task {
+      using operation_state_concept = operation_state_t;
       using promise_type = connect-awaitable-promise;
       coroutine_handle<> coro; // exposition only