1#ifndef KOKKOS_EXECUTION_IMPL_SYNC_WAIT_HPP
2#define KOKKOS_EXECUTION_IMPL_SYNC_WAIT_HPP
16 stdexec::run_loop::scheduler
schd;
19 auto query(stdexec::get_scheduler_t)
const noexcept -> stdexec::run_loop::scheduler {
24 auto query(stdexec::get_delegation_scheduler_t)
const noexcept -> stdexec::run_loop::scheduler {
30template <
typename HasErrorPtr>
45template <Kokkos::ExecutionSpace Exec,
typename HasErrorPtr = std::false_type,
typename ResultType = std::tuple<>>
55 template <
typename... Args>
57 result->emplace(std::forward<Args>(args)...);
61 template <
typename Error>
62 void set_error(Error&& err) &&
noexcept requires HasErrorPtr::value
93 template <
typename Sndr>
94 using sends_error = std::bool_constant<stdexec::__sends<stdexec::set_error_t, Sndr, env>>;
96 template <
typename Sndr>
97 using result_t = stdexec::__sync_wait::__value_tuple_for_t<Sndr>;
99 template <
typename Sndr>
102 template <
typename Sndr>
109 template <stdexec::sender Sndr>
113 static_assert(
noexcept(std::declval<State<sends_error<Sndr&&>>>().loop.run()));
117 std::optional<result_t<Sndr&&>> result{};
120 .state = stdexec::get_completion_scheduler<stdexec::set_value_t>(
121 stdexec::get_env(sndr),
env{.schd = runloop_state.loop.get_scheduler()})
123 .runloop_state = std::addressof(runloop_state),
124 .result = std::addressof(result)};
128 auto op_state = stdexec::connect(std::forward<Sndr>(sndr), std::move(rcvr));
130 stdexec::start(op_state);
132 runloop_state.loop.run();
135 if (runloop_state.error)
136 std::rethrow_exception(std::move(runloop_state.error));
150template <
template <
typename...>
typename SndrTrait>
152 template <
typename Sndr>
153 requires SndrTrait<Sndr, env>::value
154 auto operator()(Sndr&& sndr)
const noexcept(std::is_nothrow_invocable_v<SyncWait, Sndr&&>) {
155 return SyncWait{}(std::forward<Sndr>(sndr));
Constrain an EventType type to be a valid event type for Exec execution space type.
void wait(const Event< Exec > &event)
Wait for event to complete.
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
An event that can be recorded on an execution space instance.
Customize stdexec::sync_wait.
auto operator()(Sndr &&sndr) const noexcept(std::is_nothrow_invocable_v< SyncWait, Sndr && >)
Receiver for stdexec::sync_wait.
Impl::DeferredCompletionReceiverTag receiver_concept
std::optional< result_t< Sndr > > * result
State< sends_error< Sndr > > * runloop_state
static constexpr auto label
Impl::State< Exec > const * state
void continues_after(const Impl::Event< Exec > &event) &&noexcept
void set_error(Error &&err) &&noexcept
void set_stopped() &&noexcept
void continues_after() &&noexcept
void set_value(Args &&... args) &&noexcept
constexpr auto get_env() const noexcept -> env
Inspired by https://github.com/NVIDIA/stdexec/blob/16076a81efa4477513e6ede9c2741fd034ecef99/include/s...
Receiver< Impl::exec_of_t< Sndr, env >, sends_error< Sndr >, result_t< Sndr > > receiver_t
static constexpr bool is_nothrow_connectable
std::bool_constant< stdexec::__sends< stdexec::set_error_t, Sndr, env > > sends_error
auto operator()(Sndr &&sndr) const noexcept(!sends_error< Sndr && >::value &&is_nothrow_connectable< Sndr && >) -> std::optional< result_t< Sndr && > >
stdexec::__sync_wait::__value_tuple_for_t< Sndr > result_t
Inspired by https://github.com/NVIDIA/stdexec/blob/16076a81efa4477513e6ede9c2741fd034ecef99/include/s...
auto query(stdexec::get_delegation_scheduler_t) const noexcept -> stdexec::run_loop::scheduler
stdexec::run_loop::scheduler schd
auto query(stdexec::get_scheduler_t) const noexcept -> stdexec::run_loop::scheduler