std::execution::sync_wait(3)
okay so bestie, welcome to std::execution::sync_wait(3) from the C++ Standard Libary manual πβ¨ this page is about a C++26 little guy that blocks and waits, and weβre gonna read it together, no cap.
π NAME π
std::execution::sync_wait β std::execution::sync_wait π (yes bestie, thatβs the whole name section; itβs giving main-character repetition β¨)
πΈ Synopsis πΈ
Defined in header <execution> π, and the signature is literally this:
Defined in header <execution>
auto sync_wait( execution::sender auto sender )
requires (/*always-sends-some-values*/(sender))
(since C++26)
-> std::optional<std::tuple</*value-sent-by*/(sender)>>;
So yeah: requires (/*always-sends-some-values*/(sender)), since C++26, and the arrow points to std::optional<std::tuple</*value-sent-by*/(sender)>> π
periodt.
π¦ Parameters π¦
senderβ the sender upon which the completion ofsync_waitis blocked π«Ά thatβs the whole vibe:sync_waitis blocked on this senderβs completion, fr fr.
π Return value π
It returns an std::optional tuple of values that were sent by the provided sender on its completion of work β¨ optional tuple energy, bestie β thatβs the whole return value, no cap.
π₯ Notes π₯
The sender returned by sync_wait is similarly to ensure_started, except that it blocks the current std::thread or thread of main until the work is completed π yes, thatβs the note; the blocking is the whole point, and ensure_started is the comparison, iykyk.
π See also π
- function template β Eagerly starts a sender, returning a sender that will deliver the results to a receiver to which it is connected and started, if any. When the result sender is not connected to a receiver, or if the
ensure_startedresulting operation state is not started, the results are ignored. If such a sender is destroyed before the underlying operation completes, the operation continues running detached. π
this is the see-also entry, and itβs a function template, periodt π
thatβs the whole page, bestie π«Ά source: http://cppreference.com; version/date: 2024.06.10; page: std::execution::sync_wait(3). periodt π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms