hpx::post#

Defined in header hpx/future.hpp.

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

namespace hpx

Functions

template<typename F, typename ...Ts>
bool 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.