hpx/execution_base/receiver.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
execution
-
namespace
experimental
Functions
-
template<typename
R
, typename ...As
>
voidset_value
(R &&r, As&&... as)¶ set_value is a customization point object. The expression
hpx::execution::set_value(r, as...)
is equivalent to:r.set_value(as...)
, if that expression is valid. If the function selected does not send the value(s)as...
to the Receiverr
’s value channel, the program is ill-formed (no diagnostic required).Otherwise, `set_value(r, as…), if that expression is valid, with overload resolution performed in a context that include the declaration
void set_value();
Otherwise, the expression is ill-formed.
The customization is implemented in terms of
hpx::functional::tag_invoke
.
-
template<typename
R
>
voidset_stopped
(R &&r)¶ set_stopped is a customization point object. The expression
hpx::execution::set_stopped(r)
is equivalent to:r.set_stopped()
, if that expression is valid. If the function selected does not signal the Receiverr
’s done channel, the program is ill-formed (no diagnostic required).Otherwise, `set_stopped(r), if that expression is valid, with overload resolution performed in a context that include the declaration
void set_stopped();
Otherwise, the expression is ill-formed.
The customization is implemented in terms of
hpx::functional::tag_invoke
.
-
template<typename
R
, typenameE
>
voidset_error
(R &&r, E &&e)¶ set_error is a customization point object. The expression
hpx::execution::set_error(r, e)
is equivalent to:r.set_stopped(e)
, if that expression is valid. If the function selected does not send the errore
the Receiverr
’s error channel, the program is ill-formed (no diagnostic required).Otherwise, `set_error(r, e), if that expression is valid, with overload resolution performed in a context that include the declaration
void set_error();
Otherwise, the expression is ill-formed.
The customization is implemented in terms of
hpx::functional::tag_invoke
.
Variables
-
hpx::execution::experimental::set_value_t
set_value
¶
-
hpx::execution::experimental::set_error_t
set_error
¶
-
hpx::execution::experimental::set_stopped_t
set_stopped
¶
-
template<typename
T
, typenameE
= std::exception_ptr>
constexpr boolis_receiver_v
= is_receiver<T, E>::value¶
-
template<typename
T
, typename ...As
>
constexpr boolis_receiver_of_v
= is_receiver_of<T, As...>::value¶
-
template<typename
T
, typenameE
>
structis_receiver
¶ - #include <receiver.hpp>
Receiving values from asynchronous computations is handled by the
Receiver
concept. AReceiver
needs to be able to receive an error or be marked as being canceled. As such, the Receiver concept is defined by having the following two customization points defined, which form the completion-signal operations:hpx::execution::experimental::set_stopped
hpx::execution::experimental::set_error
Those two functions denote the completion-signal operations. The Receiver contract is as follows:
None of a Receiver’s completion-signal operation shall be invoked before
hpx::execution::experimental::start
has been called on the operation state object that was returned by connecting a Receiver to a senderhpx::execution::experimental::connect
.Once
hpx::execution::start
has been called on the operation state object, exactly one of the Receiver’s completion-signal operation shall complete without an exception before the Receiver is destroyed
Once one of the Receiver’s completion-signal operation has been completed without throwing an exception, the Receiver contract has been satisfied. In other words: The asynchronous operation has been completed.
-
template<typename
T
, typename ...As
>
structis_receiver_of
¶ - #include <receiver.hpp>
The
receiver_of
concept is a refinement of theReceiver
concept by requiring one additional completion-signal operation:hpx::execution::set_value
This completion-signal operation adds the following to the Receiver’s contract:
If
hpx::execution::set_value
exits with an exception, it is still valid to callhpx::execution::set_error
orhpx::execution::set_stopped
- See
hpx::execution::traits::is_receiver
-
template<typename
-
namespace
-
namespace