hpx/async_distributed/packaged_action.hpp#

Defined in header hpx/async_distributed/packaged_action.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace lcos
template<typename Action, typename Result, bool DirectExecute>
class packaged_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.

template<typename Action, typename Result>
class packaged_action<Action, Result, false> : public hpx::distributed::promise<Result, hpx::traits::extract_action<Action>::remote_result_type>#

Subclassed by hpx::lcos::packaged_action< Action, Result, true >

Public Functions

inline packaged_action()#
template<typename Allocator>
inline packaged_action(std::allocator_arg_t, Allocator const &alloc)#
template<typename ...Ts>
inline void post(hpx::id_type const &id, Ts&&... vs)#
template<typename ...Ts>
inline void post(naming::address &&addr, hpx::id_type const &id, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_cb(hpx::id_type const &id, Callback &&cb, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_cb(naming::address &&addr, hpx::id_type const &id, Callback &&cb, Ts&&... vs)#
template<typename ...Ts>
inline void post_p(hpx::id_type const &id, hpx::launch policy, Ts&&... vs)#
template<typename ...Ts>
inline void post_p(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_p_cb(hpx::id_type const &id, hpx::launch policy, Callback &&cb, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_p_cb(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Callback &&cb, Ts&&... vs)#
template<typename ...Ts>
inline void post_deferred(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_deferred_cb(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Callback &&cb, Ts&&... vs)#

Protected Types

using action_type = typename hpx::traits::extract_action<Action>::type#
using remote_result_type = typename action_type::remote_result_type#
using base_type = hpx::distributed::promise<Result, remote_result_type>#

Protected Functions

template<typename ...Ts>
inline void do_post(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Ts&&... vs)#
template<typename ...Ts>
inline void do_post(hpx::id_type const &id, hpx::launch policy, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void do_post_cb(naming::address &&addr, hpx::id_type const &id, hpx::launch policy, Callback &&cb, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void do_post_cb(hpx::id_type const &id, hpx::launch policy, Callback &&cb, Ts&&... vs)#
template<typename Action, typename Result>
class packaged_action<Action, Result, true> : public hpx::lcos::packaged_action<Action, Result, false>#

Public Functions

inline packaged_action()#

Construct a (non-functional) instance of an packaged_action. To use this instance its member function post needs to be directly called.

template<typename Allocator>
inline packaged_action(std::allocator_arg_t, Allocator const &alloc)#
template<typename ...Ts>
inline void post(hpx::id_type const &id, Ts&&... vs)#
template<typename ...Ts>
inline void post(naming::address &&addr, hpx::id_type const &id, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_cb(hpx::id_type const &id, Callback &&cb, Ts&&... vs)#
template<typename Callback, typename ...Ts>
inline void post_cb(naming::address &&addr, hpx::id_type const &id, Callback &&cb, Ts&&... vs)#

Private Types

using action_type = typename packaged_action<Action, Result, false>::action_type#