[exec.sync.wait.var] (original) (raw)
33 Execution control library [exec]
33.9 Senders [exec.snd]
33.9.13 Sender consumers [exec.consumers]
33.9.13.2 this_thread::sync_wait_with_variant [exec.sync.wait.var]
The name this_thread::sync_wait_with_variant denotes a customization point object.
For a subexpression sndr, let Sndr be decltype(into_variant(sndr)).
If sender_in<Sndr, _sync-wait-env_>is false,this_thread::sync_wait_with_variant(sndr) is ill-formed.
Otherwise, it is expression-equivalent to the following, except sndr is evaluated only once:apply_sender(get-domain-early(sndr), sync_wait_with_variant, sndr) Mandates:
- The type sync-wait-with-variant-result-type<Sndr>is well-formed.
- same_as<decltype(e), _sync-wait-with-variant-result-type_<Sndr>>is true, where e is the apply_sender expression above.
If callable<sync_wait_t, Sndr> is false, the expression sync_wait_with_variant.apply_sender(sndr) is ill-formed.
Otherwise, it is equivalent to:using result_type = sync-wait-with-variant-result-type<Sndr>;if (auto opt_value = sync_wait(into_variant(sndr))) { return result_type(std::move(get<0>(*opt_value)));} return result_type(nullopt);
The behavior of this_thread::sync_wait_with_variant(sndr)is undefined unless:
- It blocks the current thread of execution ([defns.block]) with forward progress guarantee delegation ([intro.progress]) until the specified sender completes.
[Note 1:
The default implementation of sync_wait_with_variant achieves forward progress guarantee delegation by relying on the forward progress guarantee delegation provided by sync_wait.
— _end note_] - It returns the specified sender's async results as follows: