Skip to content

Commit f233a5d

Browse files
committed
P3396R1 std::execution wording fixes
- Replace 'one of' with 'either'. - Replace 'Where' with more appropriate phrasing.
1 parent 219b959 commit f233a5d

File tree

1 file changed

+77
-34
lines changed

1 file changed

+77
-34
lines changed

source/exec.tex

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
\item
9292
\tcode{err} if \tcode{decay_t<Err>} denotes the type \tcode{exception_ptr}.
9393

94-
\mandates
95-
\tcode{err != exception_ptr()} is \tcode{true}.
94+
\expects
95+
\tcode{!err} is \tcode{false}.
9696
\item
9797
Otherwise,
9898
\tcode{make_exception_ptr(system_error(err))}
@@ -229,7 +229,6 @@
229229
representing the execution-time properties of the operation's caller.
230230
The caller of an asynchronous operation is
231231
its parent operation or the function that created it.
232-
An asynchronous operation's operation state owns the operation's environment.
233232

234233
\pnum
235234
An asynchronous operation has an associated receiver.
@@ -1012,7 +1011,7 @@
10121011
-> @\libconcept{same_as}@<remove_cvref_t<Sch>>;
10131012
} &&
10141013
@\libconcept{equality_comparable}@<remove_cvref_t<Sch>> &&
1015-
@\libconcept{copy_constructible}@<remove_cvref_t<Sch>>;
1014+
@\libconcept{copyable}@<remove_cvref_t<Sch>>;
10161015
}
10171016
\end{codeblock}
10181017

@@ -1025,17 +1024,15 @@
10251024
shall be modeled.
10261025

10271026
\pnum
1028-
None of a scheduler's
1029-
copy constructor,
1030-
destructor,
1031-
equality comparison, or
1032-
\tcode{swap} member functions
1027+
No operation required by
1028+
\tcode{\libconcept{copyable}<remove_cvref_t<Sch>>} and
1029+
\tcode{\libconcept{equality_comparable}<remove_cvref_t<Sch>>}
10331030
shall exit via an exception.
1034-
None of these member functions,
1031+
None of these operations,
10351032
nor a scheduler type's \tcode{schedule} function,
10361033
shall introduce data races
10371034
as a result of potentially concurrent\iref{intro.races} invocations
1038-
of those functions from different threads.
1035+
of those operations from different threads.
10391036

10401037
\pnum
10411038
For any two values \tcode{sch1} and \tcode{sch2}
@@ -1727,10 +1724,16 @@
17271724

17281725
\pnum
17291726
The expression in the \tcode{noexcept} clause of
1730-
the constructor of \exposid{basic-state} is:
1727+
the constructor of \exposid{basic-state} is
17311728
\begin{codeblock}
17321729
is_nothrow_move_constructible_v<Rcvr> &&
1733-
@\exposconcept{nothrow-callable}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>
1730+
@\exposconcept{nothrow-callable}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&> &&
1731+
(same_as<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@> ||
1732+
is_nothrow_constructible_v<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@>)
1733+
\end{codeblock}
1734+
where \exposid{get-state-result} is
1735+
\begin{codeblock}
1736+
@\exposid{call-result-t}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>.
17341737
\end{codeblock}
17351738

17361739
\pnum
@@ -1879,11 +1882,23 @@
18791882
struct @\exposid{impls-for}@<@\exposid{write-env-t}@> : @\exposid{default-impls}@ {
18801883
static constexpr auto @\exposid{get-env}@ =
18811884
[](auto, const auto& state, const auto& rcvr) noexcept {
1882-
return @\exposid{JOIN-ENV}@(state, get_env(rcvr));
1885+
return @\seebelow@;
18831886
};
18841887
};
18851888
\end{codeblock}
18861889
\end{itemdescr}
1890+
Invocation of
1891+
\tcode{\exposid{impls-for}<\exposid{write-env-t}>::\exposid{get-env}}
1892+
returns an object \tcode{e} such that
1893+
\begin{itemize}
1894+
\item
1895+
\tcode{decltype(e)} models \libconcept{queryable} and
1896+
\item
1897+
given a query object \tcode{q},
1898+
the expression \tcode{e.query(q)} is expression-equivalent
1899+
to \tcode{state.query(q)} if that expression is valid,
1900+
otherwise, \tcode{e.query(q)} is expression-equivalent
1901+
to \tcode{get_env(rcvr).query(q)}.
18871902

18881903
\rSec2[exec.snd.concepts]{Sender concepts}
18891904

@@ -2455,14 +2470,13 @@
24552470
Let \exposid{operation-state-task} be the following exposition-only class:
24562471
\begin{codeblock}
24572472
namespace std::execution {
2458-
struct @\exposid{operation-state-task}@ {
2473+
struct @\exposid{operation-state-task}@ { // \expos
24592474
using operation_state_concept = operation_state_t;
24602475
using promise_type = @\exposid{connect-awaitable-promise}@;
24612476

24622477
explicit @\exposid{operation-state-task}@(coroutine_handle<> h) noexcept : coro(h) {}
2463-
@\exposid{operation-state-task}@(@\exposid{operation-state-task}@&& o) noexcept
2464-
: @\exposid{coro}@(exchange(o.@\exposid{coro}@, {})) {}
2465-
~@\exposid{operation-state-task}@() { if (@\exposid{coro}@) @\exposid{coro}@.destroy(); }
2478+
@\exposid{operation-state-task}@(@\exposid{operation-state-task}@&&) = delete;
2479+
~@\exposid{operation-state-task}@() { @\exposid{coro}@.destroy(); }
24662480

24672481
void start() & noexcept {
24682482
@\exposid{coro}@.resume();
@@ -3053,15 +3067,14 @@
30533067
using result_t = @\exposid{decayed-tuple}@<Tag, Args...>;
30543068
constexpr bool nothrow = is_nothrow_constructible_v<result_t, Tag, Args...>;
30553069

3056-
@\exposid{TRY-EVAL}@(rcvr, [&]() noexcept(nothrow) {
3070+
try {
30573071
state.@\exposid{async-result}@.template emplace<result_t>(Tag(), std::forward<Args>(args)...);
3058-
}());
3059-
3060-
if (state.@\exposid{async-result}@.valueless_by_exception())
3061-
return;
3062-
if (state.@\exposid{async-result}@.index() == 0)
3063-
return;
3064-
3072+
} catch (...) {
3073+
if constexpr (!nothrow) {
3074+
set_error(std::move(rcvr), current_exception());
3075+
return;
3076+
}
3077+
}
30653078
start(state.@\exposid{op-state}@);
30663079
};
30673080
\end{codeblock}
@@ -3448,14 +3461,25 @@
34483461
}
34493462

34503463
decltype(auto) get_env() const noexcept {
3451-
return @\exposid{JOIN-ENV}@(@\exposid{env}@, @\exposid{FWD-ENV}@(execution::get_env(@\exposid{rcvr}@)));
3464+
return @\seebelow@;
34523465
}
34533466

34543467
Rcvr& @\exposid{rcvr}@; // \expos
34553468
Env @\exposid{env}@; // \expos
34563469
};
34573470
}
34583471
\end{codeblock}
3472+
Invocation of the function \tcode{\exposid{receiver2}::get_env}
3473+
returns an object \tcode{e} such that
3474+
\begin{itemize}
3475+
\item
3476+
\tcode{decltype(e)} models \libconcept{queryable} and
3477+
\item
3478+
given a query object \tcode{q},
3479+
the expression \tcode{e.query(q)} is expression-equivalent
3480+
to \tcode{\exposid{env}.query(q)} if that expression is valid,
3481+
otherwise \tcode{e.query(q)} is expression-equivalent
3482+
to \tcode{get_env(\exposid{rcvr}).query(q)}.
34593483

34603484
\pnum
34613485
\tcode{\exposid{impls-for}<\exposid{decayed-typeof}<\exposid{let-cpo}>>::\exposid{get-state}}
@@ -3647,7 +3671,7 @@
36473671
\item
36483672
on a value completion operation,
36493673
invokes \tcode{f(i, args...)}
3650-
for every \tcode{i} of type \tcode{Shape} from \tcode{0} to \tcode{shape},
3674+
for every \tcode{i} of type \tcode{Shape} in \range{\tcode{0}}{\tcode{shape}},
36513675
where \tcode{args} is a pack of lvalue subexpressions
36523676
referring to the value completion result datums of the input sender, and
36533677
\item
@@ -4101,10 +4125,20 @@
41014125
equivalent to the following lambda expression:
41024126
\begin{codeblock}
41034127
[]<class State, class Rcvr>(auto&&, State& state, const Receiver& rcvr) noexcept {
4104-
return @\exposid{JOIN-ENV}@(
4105-
@\exposid{MAKE-ENV}@(get_stop_token, state.@\exposid{stop_src}@.get_token()), get_env(rcvr));
4128+
return @\seebelow@;
41064129
}
41074130
\end{codeblock}
4131+
Returns an object \tcode{e} such that
4132+
\begin{itemize}
4133+
\item
4134+
\tcode{decltype(e)} models \libconcept{queryable}, and
4135+
\item
4136+
\tcode{e.query(get_stop_token)} is expression-equivalent to
4137+
\tcode{state.\exposid{stop-src}.get_token()}, and
4138+
\item
4139+
given a query object \tcode{q} with type other than \cv{} \tcode{stop_token_t},
4140+
\tcode{e.query(q)} is expression-equivalent to \tcode{get_env(rcvr).query(q)}.
4141+
\end{itemize}
41084142

41094143
\pnum
41104144
The member \tcode{\exposid{impls-for}<when_all_t>::\exposid{get-state}}
@@ -4957,7 +4991,8 @@
49574991
A \tcode{run_loop} instance has an associated \defn{count}
49584992
that corresponds to the number of work items that are in its queue.
49594993
Additionally, a \tcode{run_loop} instance has an associated state
4960-
that can be one of \defn{starting}, \defn{running}, or \defn{finishing}.
4994+
that can be one of
4995+
\defn{starting}, \defn{running}, \defn{finishing}, or \defn{finished}.
49614996

49624997
\pnum
49634998
Concurrent invocations of the member functions of \tcode{run_loop}
@@ -5146,7 +5181,8 @@
51465181
\begin{itemize}
51475182
\item
51485183
\exposid{count} is \tcode{0} and \exposid{state} is \exposid{finishing},
5149-
in which case \exposid{pop-front} returns \tcode{nullptr}; or
5184+
in which case \exposid{pop-front} sets \exposid{state} to \exposid{finished}
5185+
and returns \tcode{nullptr}; or
51505186
\item
51515187
\exposid{count} is greater than \tcode{0},
51525188
in which case an item is removed from the front of the queue,
@@ -5191,11 +5227,14 @@
51915227
\begin{itemdescr}
51925228
\pnum
51935229
\expects
5194-
\exposid{state} is \exposid{starting}.
5230+
\exposid{state} is either \exposid{starting} or \exposid{finishing}.
51955231

51965232
\pnum
51975233
\effects
5198-
Sets the \exposid{state} to \exposid{running}. Then, equivalent to:
5234+
If \exposid{state} is \exposid{starting},
5235+
sets the \exposid{state} to \exposid{running},
5236+
otherwise leaves \exposid{state} unchanged.
5237+
Then, equivalent to:
51995238
\begin{codeblock}
52005239
while (auto* op = @\exposid{pop-front}@()) {
52015240
op->@\exposid{execute}@();
@@ -5213,6 +5252,10 @@
52135252
\end{itemdecl}
52145253

52155254
\begin{itemdescr}
5255+
\pnum
5256+
\expects
5257+
\exposid{state} is either \exposid{starting} or \exposid{running}.
5258+
52165259
\pnum
52175260
\effects
52185261
Changes \exposid{state} to \exposid{finishing}.

0 commit comments

Comments
 (0)