hpx/futures/future.hpp
hpx/futures/future.hpp#
See Public API for a list of names and headers that are part of the public HPX API.
Defines
-
HPX_MAKE_EXCEPTIONAL_FUTURE(T, errorcode, f, msg)#
-
namespace hpx
Top level HPX namespace.
Functions
-
template<typename R, typename U>
hpx::future<R> make_future(hpx::future<U> &&f)# Converts any future of type U to any other future of type R based on an existing conversion path from U to R.
-
template<typename R, typename U, typename Conv>
hpx::future<R> make_future(hpx::future<U> &&f, Conv &&conv)# Converts any future of type U to any other future of type R based on a given conversion function: R conv(U).
Converts any shared_future of type U to any other future of type R based on an existing conversion path from U to R.
Converts any future of type U to any other future of type R based on an existing conversion path from U to R.
Converts any future or shared_future of type T to a corresponding shared_future of type T.
Converts any future or shared_future of type T to a corresponding shared_future of type T.
Converts any future or shared_future of type T to a corresponding shared_future of type T.
Converts any future or shared_future of type T to a corresponding shared_future of type T.
-
template<typename T, typename Allocator, typename ...Ts>
std::enable_if_t<std::is_constructible_v<T, Ts&&...> || std::is_void_v<T>, future<T>> make_ready_future_alloc(Allocator const &a, Ts&&... ts)# Creates a pre-initialized future object with allocator (extension)
-
template<typename T, typename ...Ts>
std::enable_if_t<std::is_constructible_v<T, Ts&&...> || std::is_void_v<T>, future<T>> make_ready_future(Ts&&... ts)# The function creates a shared state that is immediately ready and returns a future associated with that shared state. For the returned future, valid() == true and is_ready() == true.
-
template<int DeductionGuard = 0, typename Allocator, typename T>
future<hpx::util::decay_unwrap_t<T>> make_ready_future_alloc(Allocator const &a, T &&init)#
-
template<int DeductionGuard = 0, typename T>
future<hpx::util::decay_unwrap_t<T>> make_ready_future(T &&init)# The function creates a shared state that is immediately ready and returns a future associated with that shared state. For the returned future, valid() == true and is_ready() == true.
-
template<typename T>
future<T> make_exceptional_future(std::exception_ptr const &e)# Creates a pre-initialized future object which holds the given error (extension)
-
template<typename T, typename E>
future<T> make_exceptional_future(E e)# Creates a pre-initialized future object which holds the given error (extension)
-
template<int DeductionGuard = 0, typename T>
future<hpx::util::decay_unwrap_t<T>> make_ready_future_at(hpx::chrono::steady_time_point const &abs_time, T &&init)# Creates a pre-initialized future object which gets ready at a given point in time (extension)
-
template<int DeductionGuard = 0, typename T>
future<hpx::util::decay_unwrap_t<T>> make_ready_future_after(hpx::chrono::steady_duration const &rel_time, T &&init)# Creates a pre-initialized future object which gets ready after a given point in time (extension)
-
future<void> make_ready_future()#
The function creates a shared state that is immediately ready and returns a future associated with that shared state. For the returned future, valid() == true and is_ready() == true.
-
template<typename R>
class future : public hpx::lcos::detail::future_base<future<R>, R># - #include <future_fwd.hpp>
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).
Public Functions
-
constexpr future() noexcept = default#
-
template<typename T>
inline future(future<T> &&other, std::enable_if_t<std::is_void_v<R> && !traits::is_future_v<T>, T>* = nullptr) noexcept#
-
~future() = default#
-
inline hpx::traits::future_traits<future>::result_type get(error_code &ec)#
-
template<typename F>
inline decltype(auto) then(F &&f, error_code &ec = throws)#
-
template<typename T0, typename F>
inline decltype(auto) then(T0 &&t0, F &&f, error_code &ec = throws)#
Private Functions
Friends
- friend struct hpx::traits::future_access
-
struct invalidate#
- #include <future_fwd.hpp>
The class template hpx::shared_future provides a mechanism to access the result of asynchronous operations, similar to hpx::future, except that multiple threads are allowed to wait for the same shared state. Unlike hpx::future, which is only moveable (so only one instance can refer to any particular asynchronous result), hpx::shared_future is copyable and multiple shared future objects may refer to the same shared state. Access to the same shared state from multiple threads is safe if each thread does it through its own copy of a shared_future object.
Public Types
Public Functions
Private Types
Private Functions
Friends
- friend struct hpx::traits::future_access
-
namespace lcos#
Functions
- template<typename R, typename U> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_future is deprecated. Use hpx::make_future instead.") hpx
- template<typename R, typename U, typename Conv> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_future is deprecated. Use hpx::make_future instead.") hpx
- template<typename T, typename Allocator, typename... Ts> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_alloc is deprecated. Use " "hpx::make_ready_future_alloc instead.") std
- template<typename T, typename... Ts> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future is deprecated. Use " "hpx::make_ready_future instead.") std
- template<typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_exceptional_future is deprecated. Use " "hpx::make_exceptional_future instead.") hpx
- template<typename T, typename E> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_exceptional_future is deprecated. Use " "hpx::make_exceptional_future instead.") hpx
- template<int DeductionGuard = 0, typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_at is deprecated. Use " "hpx::make_ready_future_at instead.") hpx
- template<int DeductionGuard = 0, typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_after is deprecated. Use " "hpx::make_ready_future_after instead.") hpx
- template<typename Allocator> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_alloc is deprecated. Use " "hpx::make_ready_future_alloc instead.") hpx
- template<typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future is deprecated. Use " "hpx::make_ready_future instead.") std
- template<typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_at is deprecated. Use " "hpx::make_ready_future_at instead.") std
- template<typename T> HPX_DEPRECATED_V (1, 8, "hpx::lcos::make_ready_future_after is deprecated. Use " "hpx::make_ready_future_after instead.") std
-
namespace serialization
-
template<typename R, typename U>