- [meta exposition-only]
- execution[meta header]
- class template[meta id-type]
- std::this_thread[meta namespace]
- cpp26[meta cpp]
namespace std::this_thread {
template<class Sndr>
struct sync-wait-receiver { // exposition only
using receiver_concept = execution::receiver_t;
sync-wait-state<Sndr>* state; // exposition only
template<class... Args>
void set_value(Args&&... args) && noexcept;
template<class Error>
void set_error(Error&& err) && noexcept;
void set_stopped() && noexcept;
sync-wait-env get_env() const noexcept { return {&state->loop}; }
};
template<class Sndr>
struct sync-wait-state { // exposition only
execution::run_loop loop; // exposition only
exception_ptr error; // exposition only
sync-wait-result-type<Sndr> result; // exposition only
};
}- execution::receiver_t[link ../execution/receiver.md]
- sync-wait-env[link sync-wait-env.md]
- execution::run_loop[link ../execution/run_loop.md]
- exception_ptr[link /reference/exception/exception_ptr.md]
- sync-wait-result-type[link sync_wait.md]
sync-wait-receiverおよびsync-wait-stateは、Senderアルゴリズム動作仕様定義で用いられる説明専用のクラステンプレートである。
Senderコンシューマsync_wait動作においてSenderと接続(connect)するReceiver、同Receiverの内部状態として利用される。
template<class... Args>
void set_value(Args&&... args) && noexcept;効果 : 下記と等価
try {
state->result.emplace(std::forward<Args>(args)...);
} catch (...) {
state->error = current_exception();
}
state->loop.finish();- emplace[link /reference/optional/optional/emplace.md]
- current_exception()[link /reference/exception/current_exception.md]
- finish()[link ../execution/run_loop/finish.md]
template<class Error>
void set_error(Error&& err) && noexcept効果 : 下記と等価
state->error = AS-EXCEPT-PTR(std::forward<Error>(err));
state->loop.finish();- AS-EXCEPT-PTR[link ../execution/as_awaitable.md]
- finish()[link ../execution/run_loop/finish.md]
void set_stopped() && noexcept;効果 : state->loop.finish()と等価。
- C++26