execution_base

The contents of this module can be included with the header hpx/modules/execution_base.hpp. These headers may be used by user-code but are not guaranteed stable (neither header location nor contents). You are using these at your own risk. If you wish to use non-public functionality from a module we strongly suggest only including the module header hpx/modules/execution_base.hpp, not the particular header in which the functionality you would like to use is defined. See Public API for a list of names that are part of the public HPX API.

namespace hpx
namespace execution_base
struct agent_base

Public Functions

virtual ~agent_base()
virtual std::string description() const = 0
virtual context_base const &context() const = 0
virtual void yield(char const *desc) = 0
virtual void yield_k(std::size_t k, char const *desc) = 0
virtual void suspend(char const *desc) = 0
virtual void resume(char const *desc) = 0
virtual void abort(char const *desc) = 0
virtual void sleep_for(hpx::chrono::steady_duration const &sleep_duration, char const *desc) = 0
virtual void sleep_until(hpx::chrono::steady_time_point const &sleep_time, char const *desc) = 0
namespace hpx
namespace execution_base
class agent_ref

Public Functions

constexpr agent_ref()
constexpr agent_ref(agent_base *impl)
constexpr agent_ref(agent_ref const&)
constexpr agent_ref &operator=(agent_ref const&)
constexpr agent_ref(agent_ref&&)
constexpr agent_ref &operator=(agent_ref&&)
constexpr operator bool() const
void reset(agent_base *impl = nullptr)
void yield(char const *desc = "hpx::execution_base::agent_ref::yield")
void yield_k(std::size_t k, char const *desc = "hpx::execution_base::agent_ref::yield_k")
void suspend(char const *desc = "hpx::execution_base::agent_ref::suspend")
void resume(char const *desc = "hpx::execution_base::agent_ref::resume")
void abort(char const *desc = "hpx::execution_base::agent_ref::abort")
template<typename Rep, typename Period>
void sleep_for(std::chrono::duration<Rep, Period> const &sleep_duration, char const *desc = "hpx::execution_base::agent_ref::sleep_for")
template<typename Clock, typename Duration>
void sleep_until(std::chrono::time_point<Clock, Duration> const &sleep_time, char const *desc = "hpx::execution_base::agent_ref::sleep_until")
agent_base &ref()

Private Functions

void sleep_for(hpx::chrono::steady_duration const &sleep_duration, char const *desc)
void sleep_until(hpx::chrono::steady_time_point const &sleep_time, char const *desc)

Private Members

agent_base *impl_

Friends

friend constexpr bool operator==(agent_ref const &lhs, agent_ref const &rhs)
friend constexpr bool operator!=(agent_ref const &lhs, agent_ref const &rhs)
std::ostream &operator<<(std::ostream&, agent_ref const&)
namespace hpx
namespace execution_base
struct context_base

Public Functions

virtual ~context_base()
virtual resource_base const &resource() const = 0
namespace hpx
namespace execution
namespace experimental

Functions

template<typename O>
void start(O &&o)

start is a customization point object. The expression hpx::execution::experimental::start(r) is equivalent to:

  • r.start(), if that expression is valid. If the function selected does not signal the receiver r’s done channel, the program is ill-formed (no diagnostic required).

  • Otherwise, `start(r), if that expression is valid, with overload resolution performed in a context that include the declaration void start();

  • Otherwise, the expression is ill-formed.

The customization is implemented in terms of hpx::function::tag_invoke

Variables

hpx::execution::experimental::start_t start
struct start_t : public hpx::functional::tag_fallback_noexcept<start_t>

Friends

template<typename OperationState>
friend constexpr auto tag_fallback_invoke(start_t, OperationState &&o)
namespace traits

Variables

template<typename O>
constexpr bool is_operation_state_v = is_operation_state<O>::value
template<typename O>
struct is_operation_state
#include <operation_state.hpp>

An operation_state is an object representing the asynchronous operation that has been returned from calling hpx::execution::experimental::connect with a sender and a receiver. The only operation on an operation_state is:

  • hpx::execution::experimental::start

hpx::execution::experimental::start can be called exactly once. Once it has been invoked, the caller needs to ensure that the receiver’s completion signaling operations strongly happen before the destructor of the state is called. The call to hpx::basic_exceution::start needs to happen strongly before the completion signaling operations.

namespace hpx
namespace execution
namespace experimental

Functions

template<typename R, typename ...As>
void set_value(R &&r, As&&... as)

set_value is a customization point object. The expression hpx::execution::set_value(r, as...) is equivalent to:

  • r.set_value(as...), if that expression is valid. If the function selected does not send to value(s) as... to the Receiver r’s value channel, the program is ill-formed (no diagnostic required).

  • Otherwise, `set_value(r, as…), if that expression is valid, with overload resolution performed in a context that include the declaration void set_value();

  • Otherwise, the expression is ill-formed.

The customization is implemented in terms of hpx::function::tag_invoke

template<typename R>
void set_done(R &&r)

set_done is a customization point object. The expression hpx::execution::set_done(r) is equivalent to:

  • r.set_done(), if that expression is valid. If the function selected does not signal the Receiver r’s done channel, the program is ill-formed (no diagnostic required).

  • Otherwise, `set_done(r), if that expression is valid, with overload resolution performed in a context that include the declaration void set_done();

  • Otherwise, the expression is ill-formed.

The customization is implemented in terms of hpx::function::tag_invoke

template<typename R, typename E>
void set_error(R &&r, E &&e)

set_error is a customization point object. The expression hpx::execution::set_error(r, e) is equivalent to:

  • r.set_done(e), if that expression is valid. If the function selected does not send the error e the Receiver r’s error channel, the program is ill-formed (no diagnostic required).

  • Otherwise, `set_error(r, e), if that expression is valid, with overload resolution performed in a context that include the declaration void set_error();

  • Otherwise, the expression is ill-formed.

The customization is implemented in terms of hpx::function::tag_invoke

struct set_done_t : public hpx::functional::tag_fallback_noexcept<set_done_t>

Friends

template<typename R>
friend constexpr auto tag_fallback_invoke(set_done_t, R &&r)
struct set_error_t : public hpx::functional::tag_fallback_noexcept<set_error_t>

Friends

template<typename R, typename E>
friend constexpr auto tag_fallback_invoke(set_error_t, R &&r, E &&e)
struct set_value_t : public hpx::functional::tag_fallback<set_value_t>

Friends

template<typename R, typename ...Args>
friend constexpr auto tag_fallback_invoke(set_value_t, R &&r, Args&&... args)
namespace traits

Variables

template<typename T, typename E = std::exception_ptr>
constexpr bool is_receiver_v = is_receiver<T, E>::value
template<typename T, typename ...As>
constexpr bool is_receiver_of_v = is_receiver_of<T, As...>::value
template<typename T, typename ...As>
constexpr bool is_nothrow_receiver_of_v = is_nothrow_receiver_of<T, As...>::value
template<typename T, typename E>
struct is_receiver
#include <receiver.hpp>

Receiving values from asynchronous computations is handled by the Receiver concept. A Receiver needs to be able to receive an error or be marked as being canceled. As such, the Receiver concept is defined by having the following two customization points defined, which form the completion-signal operations:

  • hpx::execution::experimental::set_done

  • hpx::execution::experimental::set_error

Those two functions denote the completion-signal operations. The Receiver contract is as follows:

  • None of a Receiver’s completion-signal operation shall be invoked before hpx::execution::experimental::start has been called on the operation state object that was returned by connecting a Receiver to a sender hpx::execution::experimental::connect.

  • Once hpx::execution::start has been called on the operation state object, exactly one of the Receiver’s completion-signal operation shall complete without an exception before the Receiver is destroyed

Once one of the Receiver’s completion-signal operation has been completed without throwing an exception, the Receiver contract has been satisfied. In other words: The asynchronous operation has been completed.

See

hpx::execution::traits::is_receiver_of

template<typename T, typename ...As>
struct is_receiver_of
#include <receiver.hpp>

The receiver_of concept is a refinement of the Receiver concept by requiring one additional completion-signal operation:

  • hpx::execution::set_value

This completion-signal operation adds the following to the Receiver’s contract:

  • If hpx::execution::set_value exits with an exception, it is still valid to call hpx::execution::set_error or hpx::execution::set_done

See

hpx::execution::traits::is_receiver

namespace hpx
namespace util

Functions

constexpr bool register_lock(void const*, util::register_lock_data* = nullptr)
constexpr bool unregister_lock(void const*)
constexpr void verify_no_locks()
constexpr void force_error_on_lock()
constexpr void enable_lock_detection()
constexpr void disable_lock_detection()
constexpr void trace_depth_lock_detection(std::size_t)
constexpr void ignore_lock(void const*)
constexpr void reset_ignored(void const*)
constexpr void ignore_all_locks()
constexpr void reset_ignored_all()
std::unique_ptr<held_locks_data> get_held_locks_data()
constexpr void set_held_locks_data(std::unique_ptr<held_locks_data>&&)
struct ignore_all_while_checking

Public Functions

ignore_all_while_checking()
template<typename Lock, typename Enable>
struct ignore_while_checking

Public Functions

ignore_while_checking(void const*)
namespace hpx
namespace execution_base
struct resource_base
#include <resource_base.hpp>

TODO: implement, this is currently just a dummy.

Public Functions

virtual ~resource_base()
namespace hpx
namespace execution
namespace experimental

Functions

template<typename S, typename R>
void connect(S &&s, R &&r)

connect is a customization point object. From some subexpression s and r, let S be the type such that decltype((s)) is S and let R be the type such that decltype((r)) is R. The result of the expression hpx::execution::experimental::connect(s, r) is then equivalent to:

  • s.connect(r), if that expression is valid and returns a type satisfying the operation_state (

    See

    hpx::execution::experimental::traits::is_operation_state) and if S satisfies the sender concept.

  • s.connect(r), if that expression is valid and returns a type satisfying the operation_state (

    See

    hpx::execution::experimental::traits::is_operation_state) and if S satisfies the sender concept. Overload resolution is performed in a context that include the declaration void connect();

  • Otherwise: TODO once executor is in place…

  • Otherwise, the expression is ill-formed.

The customization is implemented in terms of hpx::function::tag_invoke

Variables

hpx::execution::experimental::connect_t connect
struct connect_t : public hpx::functional::tag_fallback<connect_t>

Friends

template<typename S, typename R>
friend constexpr auto tag_fallback_invoke(connect_t, S &&s, R &&r)
namespace traits

Variables

template<typename Sender>
constexpr bool is_sender_v = is_sender<Sender>::value
template<typename Sender>
struct is_sender
#include <sender.hpp>

A sender is a type that is describing an asynchronous operation. The operation itself might not have started yet. In order to get the result of this asynchronous operation, a sender needs to be connected to a receiver with the corresponding value, error and done channels:

  • hpx::execution::experimental::connect

In addition, hpx::execution::experimental::::sender_traits needs to be specialized in some form.

A sender’s destructor shall not block pending completion of submitted operations.

template<typename Sender, typename Receiver>
struct is_sender_to
#include <sender.hpp>

See

is_sender

template<typename Sender>
struct sender_traits
#include <sender.hpp>

sender_traits expose the different value and error types exposed by a sender. This can be either specialized directly for user defined sender types or embedded value_types, error_types and sends_done inside the sender type can be provided.

Subclassed by hpx::execution::experimental::traits::sender_traits< Sender & >, hpx::execution::experimental::traits::sender_traits< Sender && >, hpx::execution::experimental::traits::sender_traits< Sender const >, hpx::execution::experimental::traits::sender_traits< Sender volatile >

namespace hpx
namespace execution_base
namespace this_thread

Functions

hpx::execution_base::agent_ref agent()
void yield(char const *desc = "hpx::execution_base::this_thread::yield")
void yield_k(std::size_t k, char const *desc = "hpx::execution_base::this_thread::yield_k")
void suspend(char const *desc = "hpx::execution_base::this_thread::suspend")
template<typename Rep, typename Period>
void sleep_for(std::chrono::duration<Rep, Period> const &sleep_duration, char const *desc = "hpx::execution_base::this_thread::sleep_for")
template<class Clock, class Duration>
void sleep_until(std::chrono::time_point<Clock, Duration> const &sleep_time, char const *desc = "hpx::execution_base::this_thread::sleep_for")
struct reset_agent

Public Functions

reset_agent(detail::agent_storage*, agent_base &impl)
reset_agent(agent_base &impl)
~reset_agent()

Public Members

detail::agent_storage *storage_
agent_base *old_
namespace util

Functions

template<typename Predicate>
void yield_while(Predicate &&predicate, const char *thread_name = nullptr, bool allow_timed_suspension = true)