@@ -137,13 +137,12 @@ namespace stdexec {
137137 using __f = __meval<
138138 __concat_completion_signatures,
139139 __meval<__eptr_completion_if_t , __all_nothrow_decay_copyable_results<_Senders...>>,
140- completion_signatures<set_stopped_t ()>,
141140 __minvoke<__with_default<__qq<__set_values_sig_t >, completion_signatures<>>, _Senders...>,
142141 __transform_completion_signatures<
143142 __completion_signatures_of_t <_Senders, _Env...>,
144143 __mconst<completion_signatures<>>::__f,
145144 __set_error_t ,
146- completion_signatures<>,
145+ completion_signatures<set_stopped_t () >,
147146 __concat_completion_signatures
148147 >...
149148 >;
@@ -191,7 +190,7 @@ namespace stdexec {
191190
192191 struct _INVALID_ARGUMENTS_TO_WHEN_ALL_ { };
193192
194- template <class _ErrorsVariant , class _ValuesTuple , class _StopToken >
193+ template <class _ErrorsVariant , class _ValuesTuple , class _StopToken , bool _SendsStopped >
195194 struct __when_all_state {
196195 using __stop_callback_t = stop_callback_for_t <_StopToken, __on_stop_request>;
197196
@@ -222,7 +221,11 @@ namespace stdexec {
222221 }
223222 break ;
224223 case __stopped:
225- stdexec::set_stopped (static_cast <_Receiver&&>(__rcvr));
224+ if constexpr (_SendsStopped) {
225+ stdexec::set_stopped (static_cast <_Receiver&&>(__rcvr));
226+ } else {
227+ STDEXEC_UNREACHABLE ();
228+ }
226229 break ;
227230 default :;
228231 }
@@ -243,7 +246,11 @@ namespace stdexec {
243246 using _Traits = __traits<_Env, _Child...>;
244247 using _ErrorsVariant = _Traits::__errors_variant;
245248 using _ValuesTuple = _Traits::__values_tuple;
246- using _State = __when_all_state<_ErrorsVariant, _ValuesTuple, stop_token_of_t <_Env>>;
249+ using _State = __when_all_state<
250+ _ErrorsVariant,
251+ _ValuesTuple,
252+ stop_token_of_t <_Env>,
253+ (sends_stopped<_Child, _Env> || ...)>;
247254 return _State{sizeof ...(_Child)};
248255 };
249256 }
@@ -309,15 +316,9 @@ namespace stdexec {
309316 // register stop callback:
310317 __state.__on_stop_ .emplace (
311318 get_stop_token (stdexec::get_env (__rcvr)), __on_stop_request{__state.__stop_source_ });
312- if (__state.__stop_source_ .stop_requested ()) {
313- // Stop has already been requested. Don't bother starting
314- // the child operations.
315- stdexec::set_stopped (static_cast <_Receiver&&>(__rcvr));
316- } else {
317- (stdexec::start (__child_ops), ...);
318- if constexpr (sizeof ...(__child_ops) == 0 ) {
319- __state.__complete (__rcvr);
320- }
319+ (stdexec::start (__child_ops), ...);
320+ if constexpr (sizeof ...(__child_ops) == 0 ) {
321+ __state.__complete (__rcvr);
321322 }
322323 };
323324
0 commit comments