hpx/async_distributed/lcos_fwd.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
distributed
-
template<typename
Result
, typenameRemoteResult
>
classpromise
¶ - #include <promise.hpp>
A promise can be used by a single thread to invoke a (remote) action and wait for the result. The result is expected to be sent back to the promise using the LCO’s set_event action
A promise is one of the simplest synchronization primitives provided by HPX. It allows to synchronize on a eager evaluated remote operation returning a result of the type Result. The promise allows to synchronize exactly one thread (the one passed during construction time).
// Create the promise (the expected result is a id_type) hpx::distributed::promise<hpx::id_type> p; // Get the associated future future<hpx::id_type> f = p.get_future(); // initiate the action supplying the promise as a // continuation apply<some_action>(new continuation(p.get_id()), ...); // Wait for the result to be returned, yielding control // in the meantime. hpx::id_type result = f.get(); // ...
- Note
The action executed by the promise must return a value of a type convertible to the type as specified by the template parameter RemoteResult
- Template Parameters
Result
: The template parameter Result defines the type this promise is expected to return from promise::get.RemoteResult
: The template parameter RemoteResult defines the type this promise is expected to receive from the remote action.
-
template<typename
-
namespace
lcos
Typedefs
-
using
instead
= hpx::distributed::promise<Result, RemoteResult>
-
template<typename
Action
, typenameResult
= typename traits::promise_local_result<typename Action::remote_result_type>::type, boolDirectExecute
= Action::direct_execution::value>
classpackaged_action
¶ - #include <packaged_action.hpp>
A packaged_action can be used by a single thread to invoke a (remote) action and wait for the result. The result is expected to be sent back to the packaged_action using the LCO’s set_event action
A packaged_action is one of the simplest synchronization primitives provided by HPX. It allows to synchronize on a eager evaluated remote operation returning a result of the type Result.
- Note
The action executed using the packaged_action as a continuation must return a value of a type convertible to the type as specified by the template parameter Result.
- Template Parameters
Action
: The template parameter Action defines the action to be executed by this packaged_action instance. The arguments arg0,… argN are used as parameters for this action.Result
: The template parameter Result defines the type this packaged_action is expected to return from its associated future packaged_action::get_future.DirectExecute
: The template parameter DirectExecute is an optimization aid allowing to execute the action directly if the target is local (without spawning a new thread for this). This template does not have to be supplied explicitly as it is derived from the template parameter Action.
-
using
-
namespace