Files
2025-10-25 03:02:53 +03:00

2.1 KiB
Raw Permalink Blame History

[coroutine.handle.resumption]

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]

1

#

Resuming a coroutine via resume, operator(), or destroy on 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;

2

#

Preconditions: *this refers to a suspended coroutine.

The coroutine is not suspended at its final suspend point.

3

#

Effects: Resumes the execution of the coroutine.

🔗

void destroy() const;

4

#

Preconditions: *this refers to a suspended coroutine.

5

#

Effects: Destroys the coroutine ([dcl.fct.def.coroutine]).