futures

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

Functions

template<typename R, typename U>
hpx::future<R> make_future(hpx::future<U> &&f)
template<typename R, typename U, typename Conv>
hpx::future<R> make_future(hpx::future<U> &&f, Conv &&conv)
template<typename R, typename U>
hpx::future<R> make_future(hpx::shared_future<U> f)
template<typename R, typename U, typename Conv>
hpx::future<R> make_future(hpx::shared_future<U> f, Conv &&conv)
template<typename R>
hpx::shared_future<R> make_shared_future(hpx::future<R> &&f)
template<typename R>
hpx::shared_future<R> &make_shared_future(hpx::shared_future<R> &f)
template<typename R>
hpx::shared_future<R> &&make_shared_future(hpx::shared_future<R> &&f)
template<typename R>
hpx::shared_future<R> const &make_shared_future(hpx::shared_future<R> const &f)
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)
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)
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)
template<typename T>
future<T> make_exceptional_future(std::exception_ptr const &e)
template<typename T, typename E>
future<T> make_exceptional_future(E e)
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)
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)
template<typename Allocator>
future<void> make_ready_future_alloc(Allocator const &a)
future<void> make_ready_future()
future<void> make_ready_future_at(hpx::chrono::steady_time_point const &abs_time)
future<void> make_ready_future_after(hpx::chrono::steady_duration const &rel_time)
template<typename R>
class future : public hpx::lcos::detail::future_base<future<R>, R>

Public Types

template<>
using result_type = R
template<>
using shared_state_type = typename base_type::shared_state_type
template<>
using completion_signatures = typename base_type::completion_signatures

Public Functions

constexpr future()
future(future &&other)
future(future<future> &&other)
future(future<shared_future<R>> &&other)
template<typename T>
future(future<T> &&other, std::enable_if_t<std::is_void_v<R> && !traits::is_future_v<T>, T>* = nullptr)
~future()
future &operator=(future &&other)
shared_future<R> share()
hpx::traits::future_traits<future>::result_type get()
hpx::traits::future_traits<future>::result_type get(error_code &ec)
template<typename F>
decltype(auto) then(F &&f, error_code &ec = throws)
template<typename T0, typename F>
decltype(auto) then(T0 &&t0, F &&f, error_code &ec = throws)
template<typename Allocator, typename F>
auto then_alloc(Allocator const &alloc, F &&f, error_code &ec = throws)

Private Types

template<>
using base_type = lcos::detail::future_base<future<R>, R>

Private Functions

future(hpx::intrusive_ptr<shared_state_type> const &state)
future(hpx::intrusive_ptr<shared_state_type> &&state)
template<typename SharedState>
future(hpx::intrusive_ptr<SharedState> const &state)

Friends

friend hpx::hpx::traits::future_access
template<typename Receiver>
lcos::detail::operation_state<Receiver, future> tag_invoke(hpx::execution::experimental::connect_t, future &&f, Receiver &&receiver)
struct invalidate

Public Functions

template<>
constexpr invalidate(future &f)
template<>
~invalidate()

Public Members

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

Public Types

template<>
using result_type = R
template<>
using shared_state_type = typename base_type::shared_state_type
template<>
using completion_signatures = typename base_type::completion_signatures

Public Functions

constexpr shared_future()
shared_future(shared_future const &other)
shared_future(shared_future &&other)
shared_future(future<R> &&other)
shared_future(future<shared_future> &&other)
template<typename T>
shared_future(shared_future<T> const &other, std::enable_if_t<std::is_void_v<R> && !traits::is_future_v<T>, T>* = nullptr)
~shared_future()
shared_future &operator=(shared_future const &other)
shared_future &operator=(shared_future &&other)
hpx::traits::future_traits<shared_future>::result_type get() const
hpx::traits::future_traits<shared_future>::result_type get(error_code &ec) const
template<typename F>
decltype(auto) then(F &&f, error_code &ec = throws) const
template<typename T0, typename F>
decltype(auto) then(T0 &&t0, F &&f, error_code &ec = throws) const
template<typename Allocator, typename F>
auto then_alloc(Allocator const &alloc, F &&f, error_code &ec = throws)

Private Types

template<>
using base_type = lcos::detail::future_base<shared_future<R>, R>

Private Functions

shared_future(hpx::intrusive_ptr<shared_state_type> const &state)
shared_future(hpx::intrusive_ptr<shared_state_type> &&state)
template<typename SharedState>
shared_future(hpx::intrusive_ptr<SharedState> const &state)

Friends

friend hpx::hpx::traits::future_access
template<typename Receiver>
lcos::detail::operation_state<Receiver, shared_future> tag_invoke(hpx::execution::experimental::connect_t, shared_future &&f, Receiver &&receiver)
template<typename Receiver>
lcos::detail::operation_state<Receiver, shared_future> tag_invoke(hpx::execution::experimental::connect_t, shared_future &f, Receiver &&receiver)
namespace lcos

Functions

template<typename R, typename U>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_future is deprecated. Use hpx::make_future instead.")
template<typename R, typename U, typename Conv>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_future is deprecated. Use hpx::make_future instead.")
template<typename T, typename Allocator, typename... Ts>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_alloc is deprecated. Use " "hpx::make_ready_future_alloc instead.")
template<typename T, typename... Ts>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future is deprecated. Use " "hpx::make_ready_future instead.")
template<typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_exceptional_future is deprecated. Use " "hpx::make_exceptional_future instead.")
template<typename T, typename E>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_exceptional_future is deprecated. Use " "hpx::make_exceptional_future instead.")
template<int DeductionGuard = 0, typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_at is deprecated. Use " "hpx::make_ready_future_at instead.")
template<int DeductionGuard = 0, typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_after is deprecated. Use " "hpx::make_ready_future_after instead.")
template<typename Allocator>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_alloc is deprecated. Use " "hpx::make_ready_future_alloc instead.")
template<typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future is deprecated. Use " "hpx::make_ready_future instead.")
template<typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_at is deprecated. Use " "hpx::make_ready_future_at instead.")
template<typename T>hpx::lcos::HPX_DEPRECATED_V(1, 8, "hpx::lcos::make_ready_future_after is deprecated. Use " "hpx::make_ready_future_after instead.")
namespace serialization

Functions

template<typename Archive, typename T>
void serialize(Archive &ar, ::hpx::future<T> &f, unsigned version)
template<typename Archive, typename T>
void serialize(Archive &ar, ::hpx::shared_future<T> &f, unsigned version)
namespace hpx
namespace lcos

Typedefs

typedef hpx::shared_future<R> instead
namespace hpx
namespace lcos
namespace local
template<typename Result, bool Cancelable>
class futures_factory<Result(), Cancelable>

Public Functions

futures_factory()
template<typename Executor, typename F>
futures_factory(Executor &exec, F &&f)
template<typename Executor>
futures_factory(Executor &exec, Result (*f)())
template<typename F, typename Enable = std::enable_if_t<!std::is_same_v<std::decay_t<F>, futures_factory>>>
futures_factory(F &&f)
futures_factory(Result (*f)())
~futures_factory()
futures_factory(futures_factory const &rhs)
futures_factory &operator=(futures_factory const &rhs)
futures_factory(futures_factory &&rhs)
futures_factory &operator=(futures_factory &&rhs)
void operator()() const
threads::thread_id_ref_type apply(const char *annotation = "futures_factory::apply", launch policy = launch::async, error_code &ec = throws) const
threads::thread_id_ref_type apply(threads::thread_pool_base *pool, const char *annotation = "futures_factory::apply", launch policy = launch::async, error_code &ec = throws) const
hpx::future<Result> get_future(error_code &ec = throws)
constexpr bool valid() const
void set_exception(std::exception_ptr const &e)

Protected Types

template<>
using task_impl_type = lcos::detail::task_base<Result>

Protected Attributes

hpx::intrusive_ptr<task_impl_type> task_
bool future_obtained_ = false
namespace hpx
template<typename R, typename ...Ts>
class packaged_task<R(Ts...)>

Public Functions

packaged_task()
template<typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, packaged_task> && is_invocable_r_v<R, FD&, Ts...>>>
packaged_task(F &&f)
template<typename Allocator, typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, packaged_task> && is_invocable_r_v<R, FD&, Ts...>>>
packaged_task(std::allocator_arg_t, Allocator const &a, F &&f)
packaged_task(packaged_task const &rhs)
packaged_task(packaged_task &&rhs)
packaged_task &operator=(packaged_task const &rhs)
packaged_task &operator=(packaged_task &&rhs)
void swap(packaged_task &rhs)
void operator()(Ts... ts)
hpx::future<R> get_future(error_code &ec = throws)
bool valid() const
void reset(error_code &ec = throws)
void set_exception(std::exception_ptr const &e)

Private Types

template<>
using function_type = hpx::move_only_function<R(Ts...)>

Private Members

function_type function_
hpx::promise<R> promise_
namespace lcos
namespace local

Typedefs

typedef hpx::promise<R> instead
namespace std

Functions

template<typename Sig>
void swap(hpx::packaged_task<Sig> &lhs, hpx::packaged_task<Sig> &rhs)
namespace hpx

Functions

template<typename R>
void swap(promise<R> &x, promise<R> &y)
template<typename R>
class promise : public hpx::detail::promise_base<R>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
void set_value(R const &r)
void set_value(R &&r)
template<typename ...Ts>
void set_value(Ts&&... ts)

Private Types

template<>
using base_type = detail::promise_base<R>
template<typename R>
class promise<R&> : public hpx::detail::promise_base<R&>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
void set_value(R &r)

Private Types

template<>
using base_type = detail::promise_base<R&>
template<>
class promise<void> : public hpx::detail::promise_base<void>

Public Functions

promise()
template<typename Allocator>
promise(std::allocator_arg_t, Allocator const &a)
promise(promise &&other)
~promise()
promise &operator=(promise &&other)
void swap(promise &other)
void set_value()

Private Types

template<>
using base_type = detail::promise_base<void>
namespace hpx
namespace traits

Typedefs

template<typename T>
using acquire_future_t = typename acquire_future<T>::type
struct acquire_future_disp

Public Functions

template<typename T>
acquire_future_t<T> operator()(T &&t) const
namespace hpx
namespace traits

Typedefs

template<typename T>
using acquire_shared_state_t = typename acquire_shared_state<T>::type
struct acquire_shared_state_disp

Public Functions

template<typename T>
acquire_shared_state_t<T> operator()(T &&t) const
template<typename R>
struct future_access<hpx::future<R>>

Public Static Functions

template<typename SharedState>
static hpx::future<R> create(hpx::intrusive_ptr<SharedState> const &shared_state)
template<typename T = void>
static hpx::future<R> create(detail::shared_state_ptr_for_t<hpx::future<hpx::future<R>>> const &shared_state)
template<typename SharedState>
static hpx::future<R> create(hpx::intrusive_ptr<SharedState> &&shared_state)
template<typename T = void>
static hpx::future<R> create(detail::shared_state_ptr_for_t<hpx::future<hpx::future<R>>> &&shared_state)
template<typename SharedState>
static hpx::future<R> create(SharedState *shared_state, bool addref = true)
static traits::detail::shared_state_ptr_t<R> const &get_shared_state(hpx::future<R> const &f)
static traits::detail::shared_state_ptr_t<R>::element_type *detach_shared_state(hpx::future<R> &&f)
template<typename Destination>
static void transfer_result(hpx::future<R> &&src, Destination &dest)

Private Static Functions

template<typename Destination>
static void transfer_result_impl(hpx::future<R> &&src, Destination &dest, std::false_type)
template<typename Destination>
static void transfer_result_impl(hpx::future<R> &&src, Destination &dest, std::true_type)
template<typename R>
struct future_access<hpx::shared_future<R>>

Public Static Functions

template<typename SharedState>
static hpx::shared_future<R> create(hpx::intrusive_ptr<SharedState> const &shared_state)
template<typename T = void>
static hpx::shared_future<R> create(detail::shared_state_ptr_for_t<hpx::shared_future<hpx::future<R>>> const &shared_state)
template<typename SharedState>
static hpx::shared_future<R> create(hpx::intrusive_ptr<SharedState> &&shared_state)
template<typename T = void>
static hpx::shared_future<R> create(detail::shared_state_ptr_for_t<hpx::shared_future<hpx::future<R>>> &&shared_state)
template<typename SharedState>
static hpx::shared_future<R> create(SharedState *shared_state, bool addref = true)
static traits::detail::shared_state_ptr_t<R> const &get_shared_state(hpx::shared_future<R> const &f)
static traits::detail::shared_state_ptr_t<R>::element_type *detach_shared_state(hpx::shared_future<R> const &f)
template<typename Destination>
static void transfer_result(hpx::shared_future<R> &&src, Destination &dest)

Private Static Functions

template<typename Destination>
static void transfer_result_impl(hpx::shared_future<R> &&src, Destination &dest, std::false_type)
template<typename Destination>
static void transfer_result_impl(hpx::shared_future<R> &&src, Destination &dest, std::true_type)
namespace hpx
namespace traits

Typedefs

template<typename SharedState, typename Allocator>
using shared_state_allocator_t = typename shared_state_allocator<SharedState, Allocator>::type

Variables

template<typename R>
constexpr bool is_shared_state_v = is_shared_state<R>::value
template<typename R>
struct future_access<hpx::future<R>>

Public Static Functions

template<typename SharedState>
static hpx::future<R> create(hpx::intrusive_ptr<SharedState> const &shared_state)
template<typename T = void>
static hpx::future<R> create(detail::shared_state_ptr_for_t<hpx::future<hpx::future<R>>> const &shared_state)
template<typename SharedState>
static hpx::future<R> create(hpx::intrusive_ptr<SharedState> &&shared_state)
template<typename T = void>
static hpx::future<R> create(detail::shared_state_ptr_for_t<hpx::future<hpx::future<R>>> &&shared_state)
template<typename SharedState>
static hpx::future<R> create(SharedState *shared_state, bool addref = true)
static traits::detail::shared_state_ptr_t<R> const &get_shared_state(hpx::future<R> const &f)
static traits::detail::shared_state_ptr_t<R>::element_type *detach_shared_state(hpx::future<R> &&f)
template<typename Destination>
static void transfer_result(hpx::future<R> &&src, Destination &dest)

Private Static Functions

template<typename Destination>
static void transfer_result_impl(hpx::future<R> &&src, Destination &dest, std::false_type)
template<typename Destination>
static void transfer_result_impl(hpx::future<R> &&src, Destination &dest, std::true_type)
template<typename R>
struct future_access<hpx::shared_future<R>>

Public Static Functions

template<typename SharedState>
static hpx::shared_future<R> create(hpx::intrusive_ptr<SharedState> const &shared_state)
template<typename T = void>
static hpx::shared_future<R> create(detail::shared_state_ptr_for_t<hpx::shared_future<hpx::future<R>>> const &shared_state)
template<typename SharedState>
static hpx::shared_future<R> create(hpx::intrusive_ptr<SharedState> &&shared_state)
template<typename T = void>
static hpx::shared_future<R> create(detail::shared_state_ptr_for_t<hpx::shared_future<hpx::future<R>>> &&shared_state)
template<typename SharedState>
static hpx::shared_future<R> create(SharedState *shared_state, bool addref = true)
static traits::detail::shared_state_ptr_t<R> const &get_shared_state(hpx::shared_future<R> const &f)
static traits::detail::shared_state_ptr_t<R>::element_type *detach_shared_state(hpx::shared_future<R> const &f)
template<typename Destination>
static void transfer_result(hpx::shared_future<R> &&src, Destination &dest)

Private Static Functions

template<typename Destination>
static void transfer_result_impl(hpx::shared_future<R> &&src, Destination &dest, std::false_type)
template<typename Destination>
static void transfer_result_impl(hpx::shared_future<R> &&src, Destination &dest, std::true_type)
namespace hpx
namespace traits

Typedefs

template<typename Future, typename F>
using future_then_result_t = typename future_then_result<Future, F>::type
template<typename R>
struct future_traits<hpx::future<R>>

Public Types

template<>
using type = R
template<>
using result_type = R
template<typename R>
struct future_traits<hpx::shared_future<R>>

Public Types

template<>
using type = R
template<>
using result_type = R const&
template<>
struct future_traits<hpx::shared_future<void>>

Public Types

template<>
using type = void
template<>
using result_type = void
namespace hpx
namespace traits

Typedefs

template<typename Future>
using future_traits_t = typename future_traits<Future>::type
template<typename R>
struct future_traits<hpx::future<R>>

Public Types

template<>
using type = R
template<>
using result_type = R
template<typename R>
struct future_traits<hpx::shared_future<R>>

Public Types

template<>
using type = R
template<>
using result_type = R const&
template<>
struct future_traits<hpx::shared_future<void>>

Public Types

template<>
using type = void
template<>
using result_type = void
namespace hpx
namespace traits
template<typename Result, typename RemoteResult, typename Enable = void>
struct get_remote_result

Public Static Functions

static Result call(RemoteResult const &rhs)
static Result call(RemoteResult &&rhs)
template<typename Result>
struct get_remote_result<Result, Result>

Public Static Functions

static Result const &call(Result const &rhs)
static Result &&call(Result &&rhs)
namespace hpx
namespace traits

Variables

template<typename R>
constexpr bool is_future_v = is_future<R>::value
template<typename ...Ts>
constexpr bool is_future_any_v = is_future_any<Ts...>::value
template<typename R>
constexpr bool is_ref_wrapped_future_v = is_ref_wrapped_future<R>::value
template<typename Future>
struct is_future : public hpx::traits::detail::is_future_customization_point<std::decay_t<Future>>

Subclassed by hpx::traits::is_ref_wrapped_future< std::reference_wrapper< Future > >

namespace hpx
namespace traits

Typedefs

template<typename R>
using is_future_range_t = typename is_future_range<R>::type
template<typename R>
using is_ref_wrapped_future_range_t = typename is_ref_wrapped_future_range<R>::type

Variables

template<typename R>
constexpr bool is_future_range_v = is_future_range<R>::value
template<typename R>
constexpr bool is_ref_wrapped_future_range_v = is_ref_wrapped_future_range<R>::value
template<typename R>
struct future_range_traits<R, true>

Public Types

template<>
using future_type = typename range_traits<R>::value_type
template<>
struct promise_local_result<util::unused_type>

Public Types

template<>
using type = void
namespace hpx
namespace traits

Typedefs

template<typename Result>
using promise_local_result_t = typename promise_local_result<Result>::type
template<typename Result, typename Enable = void>
struct promise_local_result

Public Types

template<>
using type = Result
template<>
struct promise_local_result<util::unused_type>

Public Types

template<>
using type = void
namespace hpx
namespace traits

Typedefs

template<typename Result>
using promise_remote_result_t = typename promise_remote_result<Result>::type
template<typename Result, typename Enable = void>
struct promise_remote_result

Public Types

typedef Result type
template<>
struct promise_remote_result<void>

Public Types

typedef hpx::util::unused_type type