diff --git a/execution.html b/execution.html index 0e26404..2b657fc 100644 --- a/execution.html +++ b/execution.html @@ -2347,7 +2347,7 @@
std :: execution
Make it valid to pass non-variadic templates to the exposition-only alias
template
, fixing the definitions of
,
, and the exposition-only alias
-template
.
sync - wait - result - type
.
Removed the query forwarding from
that was
inadvertantly left over from a previous edit.
For function types
and
denoting
and
respectively,
is true
if and only if
is true
.
For a subexpression
, let
be
and let
be:
if
denotes the type
.
Mandates:
is true
Otherwise,
if
denotes the type
,
Otherwise,
.
sndr
, let Sndr
be decltype (( sndr ))
.
The expression stopped_as_optional ( sndr )
is expression-equivalent to:
transform_sender ( -get - sender - domain ( sndr ), +get - domain - early ( sndr ), make - sender ( stopped_as_optional , {}, sndr ))
sndr
and err
, let Sndr
be decltype (( sndr ))
and let Err
be decltype (( err ))
. If the type Sndr
does not satisfy sender
or if the type Err
doesn’t satisfy movable - value
, stopped_as_error ( sndr , err )
is ill-formed. Otherwise, the expression stopped_as_error ( sndr , err )
is expression-equivalent to:
transform_sender ( -get - sender - domain ( sndr ), +get - domain - early ( sndr ), make - sender ( stopped_as_error , err , sndr ))
sndr
, let Sndr
be decltype (( sndr ))
. If sender_in < Sndr , empty_env >
is false
, start_detached
is ill-formed.
-Otherwise, the expression start_detached ( sndr )
is expression-equivalent to:
-apply_sender ( get - sender - domain ( sndr ), start_detached , sndr ) +Otherwise, the expressionis expression-equivalent to +the following except that
start_detached ( sndr ) is evaluated only once: +
sndr apply_sender ( get - domain - early ( sndr ), start_detached , sndr )
Mandates: The type of the expression above is
.
Mandates:
is true
where
is the expression above.
If the expression above does not eagerly start the sender
after
connecting it with a receiver that ignores value and stopped completion
@@ -9160,7 +9175,7 @@
false
, the
expression start_detached . apply_sender ( sndr )
is ill-formed; otherwise, it is
-expression-equivalent to start ( * new detached - operation ( sndr ))
.
+expression-equivalent to start (( new detached - operation ( sndr )) -> op )
.
this_thread :: sync_wait
[exec.sync.wait]
and
are used
-to block a current thread until a sender passed into it as an argument has
-completed, and to obtain the values (if any) it completed with.
requires that the input sender has exactly one value completion signature.
For any receiver
created by an implementation of
and
, the expressions
and
shall be well-formed. For a receiver
-created by the default implementation of
, these
-expressions shall return a scheduler to the same thread-safe,
-first-in-first-out queue of work such that tasks scheduled to the queue
-execute on the thread of the caller of
. [Note: The
-scheduler for an instance of
that is a local variable
-within
is one valid implementation. -- end note]
The templates
and
are used to determine the
-return types of
and
. Let
be the type of the expression
where
is an instance of the
-receiver created by the default implementation of
.
sync_wait
mandates that the
+input sender has exactly one value completion signature.
+ Let
be the following exposition-only class
+type:
+template < class Tag > +concept get - sched - query = // exposition only +one - of < Tag , execution :: get_scheduler_t , execution :: get_delegatee_scheduler_t > ; + +struct sync - wait - env { +execution :: run_loop * loop ; // exposition only + +friend auto tag_invoke ( get - sched - query auto , sync - wait - env self ) noexcept { +return self . loop -> get_scheduler (); +} +}; +
Let
and
be exposition-only
+template aliases that are defined as follows:
template < sender_in < sync - wait - env > Sndr > -using sync - wait - type = +using sync - wait - result - type = optional < value_types_of_t < Sndr , sync - wait - env , decayed - tuple , type_identity_t >> ; template < sender_in < sync - wait - env > Sndr > -using sync - wait - with - variant - type = optional < into - variant - type < Sndr , sync - wait - env >> ; +using sync - wait - with - variant - result - type = +optional < into - variant - type < Sndr , sync - wait - env >> ; // see [exec.into.variant]
The name
denotes a customization point object. For
-some subexpression
, let
be
. If
is false
,
-or if the type
is ill-formed,
is ill-formed.
-Otherwise,
is expression-equivalent to:
The name
denotes a customization point object. For a
+subexpression
, let
be
. If
is false
, the
+expression
is ill-formed. Otherwise, it is
+expression-equivalent to the following, except that
is evaluated only
+once:
+apply_sender ( get - domain - early ( sndr ), sync_wait , sndr )
Mandates:
Mandates: The type of the expression above is
.
The type
is well-formed.
is true
, where
is the expression above.
Let
be a class type that satisfies
, let
be an xvalue of that type,
-and let
be a const lvalue referring to
such that
has type
.
-If
is false
, or if the type
is ill-formed,
-the expression
is ill-formed; otherwise it has the following effects:
Let
be the following exposition-only class template:
+template < class Sndr > +struct sync - wait - state { +run_loop loop ; +exception_ptr error ; +sync - wait - result - type < Sndr > result ; +}; + +template < class Sndr > +struct sync - wait - receiver { +using receiver_concept = receiver_t ; +sync - wait - state < Sndr >* state ; // exposition only + +template < class Tag , class ... Ts > +void complete ( Tag , Ts && ... ts ) noexcept ; // exposition only + +template < completion - tag Tag , class ... Ts > +friend void tag_invoke ( Tag , sync - wait - receiver && self , Ts && ... ts ) noexcept { +self . complete ( Tag (), std :: forward < Ts > ( ts )...); +self . state -> loop . finish (); +} + +friend sync - wait - env tag_invoke ( get_env_t , const sync - wait - receiver & self ) noexcept { +return { & self . state -> loop }; +} +}; +
The member
behaves as follows:
If
is
, evaluates:
+try { +state -> result . emplace ( std :: forward < Ts > ( ts )...); +} catch (...) { +state -> error = current_exception (); +} +
Otherwise, if
is
, evaluates:
+state -> error = AS - EXCEPT - PTR ( std :: forward ( ts )...); // see [exec.general] +
Otherwise, does nothing.
+For a subexpression
, let
be
. If
is false
, the
+expression
is ill-formed; otherwise, it is
+equivalent to:
+sync - wait - state < Sndr > state ; +auto op = connect ( sndr , sync - wait - receiver < Sndr > { & state }); +start ( op ); + +state . loop . run (); +if ( state . error ) { +rethrow_exception ( std :: move ( state . error )); +} +return std :: move ( state . result ); +
The behavior of
is undefined unless:
Calls
, resulting in an operation state
, then calls
.
It blocks the current thread of execution with forward progress guarantee +delegation ([intro.progress]) until the specified sender completes, and
Blocks the current thread until a completion operation of
is executed. When it is:
It returns the specified sender’s async results as follows:
If
has been called, returns
. If that expression exits exceptionally, the exception is propagated to the caller of
.
For a value completion, the result datums are returned
+in a
in an engaged
object.
If
has been called, let
be the decayed type of
. If
is
, calls
. Otherwise, if the
is
, throws
. Otherwise, throws
.
For an error completion, the result datum is rethrown.
If
has been called, returns
.
For a stopped completion, a disengaged
object is returned.
The name
denotes a customization point
-object. For some subexpression
, let
be the type of
. If
is false
,
is ill-formed. Otherwise,
is expression-equivalent to:
apply_sender ( get - sender - domain ( sndr ), sync_wait_with_variant , sndr ) +object. For a subexpression, let
sndr be the type of
Sndr . If
into_variant ( sndr ) is
sender_in < Sndr , sync - wait - env > false
,is ill-formed. Otherwise, it is +expression-equivalent to the following, except
this_thread :: sync_wait_with_variant ( sndr ) is evaluated only +once: +
sndr +apply_sender ( get - domain - early ( sndr ), sync_wait_with_variant , sndr ) Mandates:
Mandates: The type of the expression above is
.
The type
is
+well-formed.
is true
,
+where
is the expression above.
The expression
is
-equal to:
if ( auto opt_value = sync_wait ( into_variant ( sndr ))) { -return std :: move ( get < 0 > ( * opt_value )); +If
+is
sender_in < Sndr , sync - wait - env > false
, the +expressionis ill-formed. +Otherwise, it is equivalent to:
sync_wait_with_variant . apply_sender ( sndr ) +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 nullopt ; +return result_type ( nullopt );
The behavior of
is undefined unless:
It blocks the current thread of execution with forward progress guarantee +delegation ([intro.progress]) until the specified sender completes, and
+It returns the specified sender’s async results as follows:
+For a value completion, the result datums are returned
+in a
of
s in an engaged
object.
For an error completion, the result datum is rethrown.
+For a stopped completion, a disengaged
object is returned.
execution :: execute
[exec.execute]The expression
is equivalent to:
rcvr . result_ptr_ -> emplace < 2 > ( AS - EXCEPT - PTR ( err )); +-rcvr . result_ptr_ -> emplace < 2 > ( AS - EXCEPT - PTR ( err )); // see [exec.general] rcvr . continuation_ . resume (); where
-is:
AS - EXCEPT - PTR ( err ) -
- -
-
if
err names the same type as
decay_t < Err > ,
exception_ptr - -
Otherwise,
-if
make_exception_ptr ( system_error ( err )) names the same type as
decay_t < Err > ,
error_code - -
Otherwise,
-.
make_exception_ptr ( err )
The expression
is equivalent to
.