hpx::future#

Defined in header hpx/future.hpp.

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

See also:

template<typename R>
class future : public hpx::lcos::detail::future_base<future<R>, R>

The class template hpx::future provides a mechanism to access the result of asynchronous operations:

  • An asynchronous operation (created via hpx::async, hpx::packaged_task, or hpx::promise) can provide a hpx::future object to the creator of that asynchronous operation.

  • The creator of the asynchronous operation can then use a variety of methods to query, wait for, or extract a value from the hpx::future. These methods may block if the asynchronous operation has not yet provided a value.

  • When the asynchronous operation is ready to send a result to the creator, it can do so by modifying shared state (e.g. hpx::promise::set_value) that is linked to the creator’s hpx::future. Note that hpx::future references shared state that is not shared with any other asynchronous return objects (as opposed to hpx::shared_future).