Related: #2164
PR #2164 restores get_completion_scheduler<set_value_t> on the lazy fallbacks for schedule_at and schedule_after.
The implementation can inspect the type of the completion scheduler returned by the native timed sender, but then returns the scheduler passed into the fallback. This is correct if timed_scheduler requires native timed operations to complete on that exact scheduler value. However, timed_scheduler currently only requires schedule_at and schedule_after to return senders.
For example, a scheduler S{context_a} could return a sender whose completion scheduler is S{context_b}. The types match, but the execution resources do not. The fallback would advertise context_a even though the native sender completes on context_b.
There is also a cv/ref question. The native sender type is probed using _Scheduler, but the actual call happens later from a non-mutable lambda and sees the captured scheduler as const S&. Ref-qualified overloads can therefore produce a different native sender type from the one inspected by the fallback.
Could we clarify the intended contract?
- If
schedule_at and schedule_after must complete on the supplied scheduler value, should timed_scheduler document or require that?
- If not, should the fallback omit the completion-scheduler query unless equality can be established?
- Should the fallback also preserve completion-scheduler queries that depend on the receiver environment, or is that out of scope?
The fallback must keep now() lazy. Issue #847 explains why computing the native sender eagerly is not equivalent.
Related: #2164
PR #2164 restores
get_completion_scheduler<set_value_t>on the lazy fallbacks forschedule_atandschedule_after.The implementation can inspect the type of the completion scheduler returned by the native timed sender, but then returns the scheduler passed into the fallback. This is correct if
timed_schedulerrequires native timed operations to complete on that exact scheduler value. However,timed_schedulercurrently only requiresschedule_atandschedule_afterto return senders.For example, a scheduler
S{context_a}could return a sender whose completion scheduler isS{context_b}. The types match, but the execution resources do not. The fallback would advertisecontext_aeven though the native sender completes oncontext_b.There is also a cv/ref question. The native sender type is probed using
_Scheduler, but the actual call happens later from a non-mutable lambda and sees the captured scheduler asconst S&. Ref-qualified overloads can therefore produce a different native sender type from the one inspected by the fallback.Could we clarify the intended contract?
schedule_atandschedule_aftermust complete on the supplied scheduler value, shouldtimed_schedulerdocument or require that?The fallback must keep
now()lazy. Issue #847 explains why computing the native sender eagerly is not equivalent.