You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>Renamed <code>let</code> to <code>let_value</code> for naming consistency.</li>
455
455
<li>Updated to use P0443R13 as a baseline.</li>
456
456
<li>Improves the wording to be closer to mergable wording and less pseudowording.</li>
457
+
<li>Modified <code>sync_wait</code> to terminate on done rather than throwing.</li>
457
458
</ul>
458
459
<h2id="differences-between-r1-and-r2"><spanclass="header-section-number">1.2</span> Differences between R1 and R2<ahref="#differences-between-r1-and-r2" class="self-link"></a></h2>
<li>blocks and returns a <code>std::optional</code> of the value type of the sender, throwing on error, and an empty <code>std::optional</code> on done.</li>
520
+
<li>blocks and returns a <code>T</code> of the value type of the sender, throwing on error, and terminates on done.</li>
<spanid="cb1-9"><ahref="#cb1-9"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> result <spanclass="op">=</span><spanclass="co">// value: 3.5</span></span>
556
+
<spanid="cb1-9"><ahref="#cb1-9"></a><spanclass="dt">int</span> result <spanclass="op">=</span><spanclass="co">// value: 3.5</span></span>
<p>As before, using <code>operator|</code> as in ranges to remove the need to pass arguments around, we can represent this more cleanly:</p>
702
703
<divclass="sourceCode" id="cb8"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb8-1"><ahref="#cb8-1"></a><spanclass="kw">auto</span> s <spanclass="op">=</span> ;</span>
703
-
<spanid="cb8-2"><ahref="#cb8-2"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> result <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
704
+
<spanid="cb8-2"><ahref="#cb8-2"></a><spanclass="dt">int</span> result <spanclass="op">=</span> sync_wait<spanclass="op">(</span></span>
<spanid="cb12-2"><ahref="#cb12-2"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just_on<spanclass="op">(</span>s, <spanclass="dv">3</span><spanclass="op">))</span>;</span>
780
+
<spanid="cb12-2"><ahref="#cb12-2"></a><spanclass="dt">int</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just_on<spanclass="op">(</span>s, <spanclass="dv">3</span><spanclass="op">))</span>;</span>
<p>Blocks the calling thread to wait for the passed sender to complete. Returns a <code>std::optional</code>of the value (or of <code>std::monostate</code>if the sender carries no value), throws if an exception is propagated and returns an empty <code>std::optional</code> on cancellation. On propagation of the <code>set_done()</code> signal, returns an empty optional.</p>
807
+
<p>Blocks the calling thread to wait for the passed sender to complete. Returns <code>T</code>when passed a <code>typed_sender</code> that sends a <code>T</code>on the value channel, where <code>T</code> may be <code>void</code>, throws if an exception is propagated and calls <code>std::terminate</code> on propagation of the <code>set_done()</code> signal.</p>
<divclass="sourceCode" id="cb15"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb15-1"><ahref="#cb15-1"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">int</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just<spanclass="op">(</span><spanclass="dv">3</span><spanclass="op">))</span>;</span>
813
-
<spanid="cb15-2"><ahref="#cb15-2"></a>std<spanclass="op">::</span>optional<spanclass="op"><</span><spanclass="dt">float</span><spanclass="op">></span> r <spanclass="op">=</span> sync_wait<spanclass="op"><</span><spanclass="dt">float</span><spanclass="op">>(</span>just<spanclass="op">(</span><spanclass="fl">3.5</span><spanclass="bu">f</span><spanclass="op">))</span>;</span>
813
+
<divclass="sourceCode" id="cb15"><preclass="sourceCode cpp"><codeclass="sourceCode cpp"><spanid="cb15-1"><ahref="#cb15-1"></a><spanclass="dt">int</span> r <spanclass="op">=</span> sync_wait<spanclass="op">(</span>just<spanclass="op">(</span><spanclass="dv">3</span><spanclass="op">))</span>;</span>
814
+
<spanid="cb15-2"><ahref="#cb15-2"></a><spanclass="dt">float</span> r <spanclass="op">=</span> sync_wait<spanclass="op"><</span><spanclass="dt">float</span><spanclass="op">>(</span>just<spanclass="op">(</span><spanclass="fl">3.5</span><spanclass="bu">f</span><spanclass="op">))</span>;</span>
<li><p>Otherwise constructs a <code>receiver</code>, <code>r</code> over an implementation-defined synchronization primitive and passes <code>r</code> to <code>execution::connect(s, r)</code> returning some <code>operation_state</code><code>os</code>. Waits on the synchronization primitive to block on completion of <code>s</code>.</p>
826
827
<ul>
827
-
<li>If the operation completes by calling <code>set_value(r, t)</code> then <code>sync_wait()</code> will return a value, <code>x</code>, of type <code>std::optional<remove_cvref_t<decltype(t)>></code>, <code>X</code>, that is initialised as if by <code>X x; x.emplace(t);</code>.</li>
828
-
<li>If the operation completes by calling <code>set_value(r)</code> then <code>sync_wait()</code> will return a value <code>x</code>, of type <code>std::optional<std::monostate></code> that is initialised as if by <code>std::optional<std::monostate> x{std::in_place};</code>.</li>
828
+
<li>If the operation completes by calling <code>set_value(r, t)</code> then <code>sync_wait()</code> will return a value, <code>x</code>, of type <code>remove_cvref_t<decltype(t)></code>.</li>
829
+
<li>If the operation completes by calling <code>set_value(r)</code> then <code>sync_wait()</code> will return <code>void</code>.</li>
829
830
<li>If the operation completes by calling <code>set_error(r, e)</code> then <code>sync_wait()</code> calls <code>std::rethrow_exception(e)</code> if <code>decltype(e)</code> is <code>std::exception_ptr</code> or <code>throw e;</code> otherwise.</li>
830
-
<li>If the operation completes by calling <code>set_done(r)</code> then <code>sync_wait()</code> will return a value <code>x</code>, of type <code>std::optional<T></code> where <code>T</code> is consistent with the return type when the operation completes with <code>set_value</code> and that is initialised as if by <code>std::optional<T> x{};</code>.</li>
831
+
<li>If the operation completes by calling <code>set_done(r)</code> then <code>sync_wait()</code> will call <code>std::terminate</code>.</li>
0 commit comments