cplusplus / sender-receiver

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

Definition of `SCHED-ATTRS` incorrectly assumes that schedule operations that complete with set_stopped will complete on that scheduler #283

Open lewissbaker opened 2 months ago

lewissbaker commented 2 months ago

The SCHED-ATTRS(sch) helper is used in the continues_on() and schedule_from() algorithms and is used to compute the sender-attributes of the sender returned from these algorithms such that they have a get_completion_scheduler<set_value_t> and get_completion_scheduler<set_stopped_t> queries that both return sch.

However, I don't think it's valid to say that a set_stopped result will always complete on the specified scheduler for these algorithms.

In the case that the schedule operation that is trying to transfer execution to the scheduler's context completes with set_stopped, it is not guaranteed that the completion is currently on the scheduler's context (it might be completing synchronously inside a stop-request from an arbitrary thread), and yet the continues_on() operation as a whole will complete with set_stopped, violating the declared get_completion_scheduler<set_stopped_t> query result.

There are a couple of strategies that we can potentially take to eliminate this inconsistency: