[coroutine.handle.resumption] (original) (raw)
17 Language support library [support]
17.13 Coroutines [support.coroutine]
17.13.4 Class template coroutine_handle [coroutine.handle]
17.13.4.6 Resumption [coroutine.handle.resumption]
Resuming a coroutine via resume, operator(), or destroyon an execution agent other than the one on which it was suspended has implementation-defined behavior unless each execution agent either is an instance of std::thread or std::jthread, or is the thread that executes main.
[Note 1:
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.
— _end note_]
[Note 2:
A concurrent resumption of the coroutine can result in a data race.
— _end note_]
void operator()() const;void resume() const;
Preconditions: *this refers to a suspended coroutine.
The coroutine is not suspended at its final suspend point.
Effects: Resumes the execution of the coroutine.
Preconditions: *this refers to a suspended coroutine.