Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/exec/finally.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace exec {
void set_value() noexcept {
STDEXEC_TRY {
auto& __result = __op_->__result_.__get();
__result.visit(__visitor{}, static_cast<_ResultType&&>(__result), __op_);
STDEXEC::__visit(__visitor{}, static_cast<_ResultType&&>(__result), __op_);
}
STDEXEC_CATCH_ALL {
if constexpr (!__mapply_q<__nothrow_decay_copyable_t, _ResultType>::value) {
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace exec {
.template emplace<__decayed_tuple<_Args...>>(static_cast<_Args&&>(__args)...);
STDEXEC_ASSERT(__op_.index() == 0);
auto __final = static_cast<_FinalSender&&>(__op_.template get<0>().__sndr_);
__final_op_t& __final_op = __op_.template emplace_from_at<1>(
__final_op_t& __final_op = __op_.template __emplace_from<1>(
STDEXEC::connect, static_cast<_FinalSender&&>(__final), __final_receiver_t{this});
STDEXEC::start(__final_op);
}
Expand Down
4 changes: 2 additions & 2 deletions include/exec/fork_join.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace exec {
using operation_state_concept = STDEXEC::operation_state_t;

STDEXEC_ATTRIBUTE(host, device) void start() noexcept {
Variant::visit(_dematerialize_fn{}, *_results_, _rcvr_);
STDEXEC::__visit(_dematerialize_fn{}, *_results_, _rcvr_);
}

Rcvr _rcvr_;
Expand Down Expand Up @@ -160,7 +160,7 @@ namespace exec {

STDEXEC_ATTRIBUTE(host, device) ~_opstate_t() {
// If this opstate was never started, we must explicitly destroy the _child_opstate_.
if (_cache_.is_valueless()) {
if (_cache_.__is_valueless()) {
_child_opstate_.__destroy();
}
}
Expand Down
4 changes: 2 additions & 2 deletions include/exec/sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace exec {
// Below, it looks like we are using `sndrs` after it has been moved from. This is not the
// case. `sndrs` is moved into a tuple type that has `__ignore` for the first element. The
// result is that the first sender in `sndrs` is not moved from, but the rest are.
_ops.template emplace_from_at<0>(
_ops.template __emplace_from<0>(
STDEXEC::connect, STDEXEC::__get<0>(static_cast<CvrefSndrs&&>(sndrs)), _rcvr_t<0>{this});
}

Expand All @@ -127,7 +127,7 @@ namespace exec {
STDEXEC::set_value(static_cast<Rcvr&&>(_rcvr), static_cast<Args&&>(args)...);
} else {
auto& sndr = STDEXEC::__get<Idx>(_sndrs);
auto& op = _ops.template emplace_from_at<Idx>(
auto& op = _ops.template __emplace_from<Idx>(
STDEXEC::connect, std::move(sndr), _rcvr_t<Idx>{this});
STDEXEC::start(op);
}
Expand Down
27 changes: 13 additions & 14 deletions include/exec/sequence/ignore_all_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,21 @@ namespace exec {
[[gnu::noinline]]
#endif
void __visit_result(_Receiver __rcvr) noexcept {
int __is_emplaced = __emplaced_.load(__std::memory_order_acquire);
if (__is_emplaced == 0) {
if (__emplaced_.load(__std::memory_order_acquire) == 0) {
STDEXEC::set_value(static_cast<_Receiver&&>(__rcvr));
return;
} else if constexpr (STDEXEC::__mapply<STDEXEC::__msize, _ResultVariant>::value != 0) {
STDEXEC_ASSERT(__result_.index() != __variant_npos);
STDEXEC::__visit(
[&]<class _Tuple>(_Tuple&& __tuple) noexcept {
STDEXEC::__apply(
[&]<__completion_tag _Tag, class... _Args>(
_Tag __completion, _Args&&... __args) noexcept {
__completion(static_cast<_Receiver&&>(__rcvr), static_cast<_Args&&>(__args)...);
},
static_cast<_Tuple&&>(__tuple));
},
static_cast<_ResultVariant&&>(__result_));
}
STDEXEC_ASSERT(__result_.index() != __variant_npos);
__result_.visit(
[&]<class _Tuple>(_Tuple&& __tuple) noexcept {
STDEXEC::__apply(
[&]<__completion_tag _Tag, class... _Args>(
_Tag __completion, _Args&&... __args) noexcept {
__completion(static_cast<_Receiver&&>(__rcvr), static_cast<_Args&&>(__args)...);
},
static_cast<_Tuple&&>(__tuple));
},
static_cast<_ResultVariant&&>(__result_));
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/exec/sequence/iterate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace exec {
STDEXEC::set_value(static_cast<_Receiver&&>(__rcvr_));
} else {
STDEXEC_TRY {
STDEXEC::start(__op_.emplace_from(
STDEXEC::start(__op_.__emplace_from(
STDEXEC::connect,
exec::set_next(
__rcvr_, exec::sequence(STDEXEC::schedule(__scheduler_), __sender_t<_Range>{this})),
Expand Down
4 changes: 2 additions & 2 deletions include/exec/sequence/merge_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace exec {

void start() & noexcept {
// emit delayed error into the sequence
__op_->__error_storage_->visit(
STDEXEC::__visit(
[this](auto&& __error) noexcept {
STDEXEC::set_error(
static_cast<_ErrorReceiver&&>(__receiver_),
Expand Down Expand Up @@ -999,7 +999,7 @@ namespace exec {
__nothrow_subscribable<_NestedSequence, __receiver_t>
&& STDEXEC::__nothrow_constructible_from<_NestedSeqOp, __nested_op_t>;
STDEXEC_TRY {
auto& __nested_seq_op = __next_seq_op_->__nested_seq_op_.emplace_from(
auto& __nested_seq_op = __next_seq_op_->__nested_seq_op_.__emplace_from(
subscribe,
static_cast<_NestedSequence&&>(__sequence),
__receiver_t{__next_seq_op_, __op_});
Expand Down
4 changes: 2 additions & 2 deletions include/exec/when_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ namespace exec {
STDEXEC::set_stopped(static_cast<_Receiver&&>(__rcvr_));
return;
}
STDEXEC_ASSERT(!__result_.is_valueless());
__result_.visit(
STDEXEC_ASSERT(!__result_.__is_valueless());
STDEXEC::__visit(
__when_any::__make_visitor_fn(__rcvr_), static_cast<_ResultVariant&&>(__result_));
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/nvexec/stream/when_all.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ namespace nvexec::_strm {
}
break;
case _when_all::error:
errors_.visit(
STDEXEC::__visit(
__mk_completion_fn(STDEXEC::set_error, rcvr_),
static_cast<errors_variant_t&&>(errors_));
break;
Expand Down
52 changes: 27 additions & 25 deletions include/stdexec/__detail/__continues_on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,73 +81,75 @@ namespace STDEXEC {
using __completions_t =
__completions_impl_t<_Scheduler, __completion_signatures_of_t<_CvrefSender, _Env...>, _Env...>;

template <class _Scheduler, class _Sexpr, class _Receiver>
struct __state;

template <class _State>
STDEXEC_ATTRIBUTE(always_inline)
auto __make_visitor_fn(_State* __state) noexcept {
constexpr auto __make_visitor_fn(_State* __state) noexcept {
return [__state]<class _Tup>(_Tup& __tupl) noexcept -> void {
STDEXEC::__apply(
[&]<class... _Args>(auto __tag, _Args&... __args) noexcept -> void {
__tag(std::move(__state->__rcvr_), static_cast<_Args&&>(__args)...);
[&]<class _Tag, class... _Args>(_Tag, _Args&... __args) noexcept -> void {
_Tag()(static_cast<_State&&>(*__state).__rcvr_, static_cast<_Args&&>(__args)...);
},
__tupl);
};
}

template <class _Sexpr, class _Receiver>
struct __state_base : __immovable {
using __variant_t = __results_of<__child_of<_Sexpr>, env_of_t<_Receiver>>;

_Receiver __rcvr_;
__variant_t __data_{};
};

// This receiver is to be completed on the execution context associated with the scheduler. When
// the source sender completes, the completion information is saved off in the operation state
// so that when this receiver completes, it can read the completion out of the operation state
// and forward it to the output receiver after transitioning to the scheduler's context.
template <class _SchedulerId, class _SexprId, class _ReceiverId>
template <class _SexprId, class _ReceiverId>
struct __rcvr2 {
using _Scheduler = STDEXEC::__t<_SchedulerId>;
using _Sexpr = STDEXEC::__t<_SexprId>;
using _Receiver = STDEXEC::__t<_ReceiverId>;

struct __t {
using receiver_concept = receiver_t;
using __id = __rcvr2;

void set_value() noexcept {
__state_->__data_.visit(__trnsfr::__make_visitor_fn(__state_), __state_->__data_);
constexpr void set_value() noexcept {
STDEXEC::__visit(__trnsfr::__make_visitor_fn(__state_), __state_->__data_);
}

template <class _Error>
void set_error(_Error&& __err) noexcept {
constexpr void set_error(_Error&& __err) noexcept {
STDEXEC::set_error(
static_cast<_Receiver&&>(__state_->__rcvr_), static_cast<_Error&&>(__err));
}

void set_stopped() noexcept {
constexpr void set_stopped() noexcept {
STDEXEC::set_stopped(static_cast<_Receiver&&>(__state_->__rcvr_));
}

auto get_env() const noexcept -> env_of_t<_Receiver> {
[[nodiscard]]
constexpr auto get_env() const noexcept -> env_of_t<_Receiver> {
return STDEXEC::get_env(__state_->__rcvr_);
}

__state<_Scheduler, _Sexpr, _Receiver>* __state_;
__state_base<_Sexpr, _Receiver>* __state_;
};
};

template <class _Scheduler, class _Sexpr, class _Receiver>
using __receiver2 = __t<__rcvr2<__id<_Scheduler>, __id<_Sexpr>, __id<_Receiver>>>;
template <class _Sexpr, class _Receiver>
using __receiver2 = __t<__rcvr2<__id<_Sexpr>, __id<_Receiver>>>;

template <class _Scheduler, class _Sexpr, class _Receiver>
struct __state : __immovable {
struct __state : __state_base<_Sexpr, _Receiver> {
using __variant_t = __results_of<__child_of<_Sexpr>, env_of_t<_Receiver>>;
using __receiver2_t = __receiver2<_Scheduler, _Sexpr, _Receiver>;
using __receiver2_t = __receiver2<_Sexpr, _Receiver>;

explicit __state(_Scheduler __sched, _Receiver&& __rcvr)
: __rcvr_(static_cast<_Receiver&&>(__rcvr))
, __data_()
constexpr explicit __state(_Scheduler __sched, _Receiver&& __rcvr)
: __state::__state_base{{}, static_cast<_Receiver&&>(__rcvr), {}}
, __state2_(connect(schedule(__sched), __receiver2_t{this})) {
}

_Receiver __rcvr_;
__variant_t __data_;
connect_result_t<schedule_result_t<_Scheduler>, __receiver2_t> __state2_;
};

Expand Down Expand Up @@ -387,10 +389,10 @@ namespace STDEXEC {
// Write the tag and the args into the operation state so that we can forward the completion
// from within the scheduler's execution context.
if constexpr (__nothrow_callable<__mktuple_t, _Tag, _Args...>) {
__state.__data_.emplace_from(__mktuple, __tag, static_cast<_Args&&>(__args)...);
__state.__data_.__emplace_from(__mktuple, __tag, static_cast<_Args&&>(__args)...);
} else {
STDEXEC_TRY {
__state.__data_.emplace_from(__mktuple, __tag, static_cast<_Args&&>(__args)...);
__state.__data_.__emplace_from(__mktuple, __tag, static_cast<_Args&&>(__args)...);
}
STDEXEC_CATCH_ALL {
STDEXEC::set_error(static_cast<_State&&>(__state).__rcvr_, std::current_exception());
Expand Down
Loading
Loading