hpx::post (distributed)#

Defined in header hpx/async.hpp.

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

See also

hpx::post

template<typename F, typename ...Ts>
bool hpx::post(F &&f, Ts&&... ts)

Runs the function f asynchronously (potentially in a separate thread which might be a part of a thread pool). This is done in a fire-and-forget manner, meaning there is no return value or way to synchronize with the function execution (it does not return an hpx::future that would hold the result of that function call).

hpx::post is particularly useful when synchronization mechanisms as heavyweight as futures are not desired, and instead, more lightweight mechanisms like latches or atomic variables are preferred. Essentially, the post function enables the launch of a new thread without the overhead of creating a future.

Note

hpx::post is similar to hpx::async but does not return a future. This is why there is no way of finding out the result/failure of the execution of this function.

template<typename Action, typename ...Ts>
bool hpx::post(hpx::id_type const &id, Ts&&... vs)
template<typename Action, typename Client, typename Stub, typename Data, typename ...Ts>
bool hpx::post(components::client_base<Client, Stub, Data> const &c, Ts&&... vs)
template<typename Action, typename DistPolicy, typename ...Ts>
bool hpx::post(DistPolicy const &policy, Ts&&... vs)
template<typename Action, typename Continuation, typename ...Ts>
bool hpx::post(Continuation &&c, hpx::id_type const &gid, Ts&&... vs)
template<typename Action, typename Continuation, typename Client, typename Stub, typename Data, typename ...Ts>
bool hpx::post(Continuation &&cont, components::client_base<Client, Stub, Data> const &c, Ts&&... vs)
template<typename Action, typename Continuation, typename DistPolicy, typename ...Ts>
bool hpx::post(Continuation &&c, DistPolicy const &policy, Ts&&... vs)
template<typename Action, typename Target, typename ...Ts>
bool hpx::post(Action &&action, Target &&target, Ts&&... ts)

The distributed implementation of hpx::post can be used by giving an action instance as argument instead of a function, and also by providing another argument with the locality ID or the target ID.

Template Parameters
  • Action – The type of action instance

  • Target – The type of target where the action should be executed

  • Ts – The type of any additional arguments

Parameters
  • action – The action instance to be executed

  • target – The target where the action should be executed

  • ts – Additional arguments

Returns

true if the action was successfully posted, false otherwise.