std::execut...ure_started(3)
πΈ NAME πΈ
okay bestie, welcome to the std::execut...ure_started(3) page from the C++ Standard Libary β yes, that's the manual name, we're rolling with it π
std::execution::ensure_startedβ and the description is literallystd::execution::ensure_startedagain. Self-titled queen behavior, honestly π
β¨ Synopsis β¨
bestie, here's the whole vibe in code form π
Defined in header <execution>
execution::sender auto ensure_started(
execution::sender auto sender (since C++26)
);
That's the since C++26 glow-up, no cap β
π Parameters π
- sender β the input sender, of which the stopped channel is mapped into
errπ«Ά
π Return value π
Returns a sender which completes when the provided sender completes and sends values equivalent to those of the provided sender. Cute, consistent, iconic π
π¦ Notes π¦
- Once
ensure_startedreturns, it is known that the provided sender has been connected andstarthas been called on the resulting operation state. In other words, the work described by the provided sender has been submitted for execution on the appropriate execution resources. Slay, it's already in motion β¨ - If the returned sender is destroyed before
execution::connect()is called, or ifexecution::connect()is called but the returned operation-state is destroyed beforeexecution::start()is called, then a stop-request is sent to the eagerly launched operation and the operation is detached and will run to completion in the background. Lowkey important π«Ά - In such a case, the operation's result will be discarded when it is eventually complete. Bye-bye result, we hardly knew ye π
- Note that the application will need to make sure that resources are kept alive in the case that the operation detaches (e.g. by holding a
std::shared_ptrto those resources). This is the "keep your faves alive" rule fr fr π
β οΈ detach means background business β keep those resources alive, bestie, or it's giving undefined chaos energy π
shoutout to http://cppreference.com, dated 2024.06.10, for this std::execut...ure_started(3) moment ππβ¨
π¦ 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