std::corout...ndle::resume(3)
πΈ NAME
okay so bestie, we're cracking open the page header std::corout...ndle::resume(3) from the manual named C++ Standard Libary β yes, that spelling is exactly what's on the page π. And the NAME section is giving βsame string twiceβ energy, no cap:
std::coroutine_handle::operator(),std::coroutine_handle::resumeβstd::coroutine_handle::operator(),std::coroutine_handle::resume
β¨ Synopsis
The formatting on this page is doing a little chaos dance, but here are the exact signatures and labels, bestie:
Member of other specializations
void operator()() const;
void resume() const;
(1) (since C++20)
Member of specialization
std::coroutine_handle<std::noop_coroutine_promise>
constexpr void operator()() const noexcept;
constexpr void resume() const noexcept;
(2) (since C++20)
So overload (1) is the βMember of other specializationsβ flavor: it resumes the execution of the coroutine to which *this refers, or does nothing if the coroutine is a no-op coroutine. Overload (2) is the std::coroutine_handle<std::noop_coroutine_promise> specialization: it does nothing. Not a little nothing. Literally nothing. The way thatβs iconic for a no-op coroutine promise? Obsessed π«Ά.
π Behavior is undefined if *this does not refer to suspended coroutine, or the coroutine is not a no-op coroutine and suspended at its final suspend point. A concurrent resumption of the coroutine may result in a data race. This is the part where you do not send it β undefined behavior is not the vibe, fr fr.
Resumption of a coroutine on an execution agent other than the one on which it was suspended has implementation-defined behavior unless each execution agent either is a thread represented by std::thread or std::jthread, or is the thread executing main. Thatβs a whole mouthful but every word matters π
.
π Parameters
(none) β literally no parameters, bestie. The page says (none) and Iβm not gonna invent any.
π Return value
(none) β same energy. No return value. Periodt.
π₯ Exceptions
If an exception is thrown from the execution of the coroutine, the exception is caught and unhandled_exception is called on the coroutine's promise object. If the call to unhandled_exception throws or rethrows an exception, that exception is propagated. Catching and rethrowing tea, handled exactly like the page says π§.
π¦ Notes
A coroutine that is resumed on a different execution agent should avoid relying on consistent thread identity throughout, such as holding a mutex object across a suspend point. Thatβs the self-care note for your coroutineβs thread identity, iykyk πΈ.
π Example
This section is incomplete.
- Reason: no example
No example bestie, the page is leaving us on read π.
π See also
destroyβ destroys a coroutine;(C++20)(public member function)
π·οΈ Category:
Todo no example
byeee π«Άβ¨ source/version/date sign-off: this page comes from http://cppreference.com, dated 2024.06.10, and the page header is std::corout...ndle::resume(3) β mwah π
π.
π¦ 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