In the current async_scope draft, when_all is sometimes used to join a scope together with some other senders, for example:
sender auto snd = spawn_future(on(sched, key_work()), scope) | then(continue_fun);
for (int i = 0; i < 10; i++)
spawn(on(sched, other_work(i)), scope);
return when_all(scope.join(), std::move(snd));
...at the end of 5.6 of p3149r3.
However, if the whole work is cancelled, when_all will not even start the join_sender, but exit early with set_stopped.
The proposed finally may be a better option:
return finally(std::move(snd), scope.join());
Still, I wonder if it would be best for when_all to "just work" for this use case as well, see also cplusplus/sender-receiver#295 .
In the current
async_scopedraft,when_allis sometimes used to join a scope together with some other senders, for example:...at the end of 5.6 of p3149r3.
However, if the whole work is cancelled,
when_allwill not even start thejoin_sender, but exit early withset_stopped.The proposed
finallymay be a better option:Still, I wonder if it would be best for
when_allto "just work" for this use case as well, see also cplusplus/sender-receiver#295 .