cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
19 stars 3 forks source link

Change `split` algorithm to be an algorithm over an async-scope #263

Open lewissbaker opened 3 months ago

lewissbaker commented 3 months ago

The current (P2300R10) cancellation semantics of the split algorithm are that if any of the consumers sends a stop-request then the underlying operation is cancelled for all consumers (see #200).

We should revise the semantics so that it instead only cancels the underlying operation when the last consumer goes away. However, to do this in a way that avoids the possibility of detached work, it needs to be an algorithm over an async-scope.

We should replace the current semantic of split() with something with the following shape:

sender auto split(sender auto&& source, async_scope_token auto scope, queryable env = empty_env{});

And with the following semantics:

There are similar questions with this algorithm, though, about whether the allocation of the shared state should be guarded by the async-scope. i.e. so that join() completes only after all allocations made by split(), et. al. are released.

lewissbaker commented 2 weeks ago

This issue needs a paper to be written, ideally in time for the October 2024 mailing (pre-Poland).

The specification of this may have some dependencies on changes to async-scope design currently being considered by @ispeters, but the motivation/design parts of the paper should be largely independent of that.