This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
[coroutine.handle.compare]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.compare)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#compare)
#### 17.13.4.8 Comparison operators [coroutine.handle.compare]
[🔗](#lib:operator==,coroutine_handle)
`constexpr bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6120)
*Returns*: x.address() == y.address()[.](#1.sentence-1)
[🔗](#lib:operator%3c=%3e,coroutine_handle)
`constexpr strong_ordering operator<=>(coroutine_handle<> x, coroutine_handle<> y) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6131)
*Returns*: compare_three_way()(x.address(), y.address())[.](#2.sentence-1)

View File

@@ -0,0 +1,61 @@
[coroutine.handle.con]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.con)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#con)
#### 17.13.4.2 Construct/reset [coroutine.handle.con]
[🔗](#lib:coroutine_handle,constructor)
`constexpr coroutine_handle() noexcept;
constexpr coroutine_handle(nullptr_t) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5916)
*Postconditions*: address() == nullptr[.](#1.sentence-1)
[🔗](#lib:from_promise,coroutine_handle)
`static coroutine_handle from_promise(Promise& p);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5927)
*Preconditions*: p is a reference to a promise object of a coroutine[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5931)
*Postconditions*: addressof(h.promise()) == addressof(p)[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5935)
*Returns*: A coroutine handle h referring to the coroutine[.](#4.sentence-1)
[🔗](#lib:operator=,coroutine_handle)
`coroutine_handle& operator=(nullptr_t) noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5946)
*Postconditions*: address() == nullptr[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5950)
*Returns*: *this[.](#6.sentence-1)

View File

@@ -0,0 +1,20 @@
[coroutine.handle.conv]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.conv)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#conv)
#### 17.13.4.3 Conversion [coroutine.handle.conv]
[🔗](#lib:operator_coroutine_handle%3c%3e,coroutine_handle)
`constexpr operator coroutine_handle<>() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5963)
*Effects*: Equivalent to: return coroutine_handle<>::from_address(address());

View File

@@ -0,0 +1,54 @@
[coroutine.handle.export.import]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.export.import)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#export.import)
#### 17.13.4.4 Export/import [coroutine.handle.export.import]
[🔗](#lib:address,coroutine_handle)
`constexpr void* address() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5976)
*Returns*: ptr[.](#1.sentence-1)
[🔗](#lib:from_address,coroutine_handle)
`static constexpr coroutine_handle<> coroutine_handle<>::from_address(void* addr);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5987)
*Preconditions*: addr was obtained via a prior call to address on an object whose type is a specialization of coroutine_handle[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5992)
*Postconditions*: from_address(address()) == *this[.](#3.sentence-1)
[🔗](#lib:from_address,coroutine_handle_)
`static constexpr coroutine_handle<Promise> coroutine_handle<Promise>::from_address(void* addr);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6003)
*Preconditions*: addr was obtained via a prior call to address on an object of type cv coroutine_handle<Promise>[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6008)
*Postconditions*: from_address(address()) == *this[.](#5.sentence-1)

View File

@@ -0,0 +1,35 @@
[coroutine.handle.general]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.general)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#general)
#### 17.13.4.1 General [coroutine.handle.general]
[🔗](#lib:coroutine_handle)
namespace std {template<>struct coroutine_handle<void>{// [[coroutine.handle.con]](coroutine.handle.con "17.13.4.2Construct/reset"), construct/resetconstexpr coroutine_handle() noexcept; constexpr coroutine_handle(nullptr_t) noexcept;
coroutine_handle& operator=(nullptr_t) noexcept; // [[coroutine.handle.export.import]](coroutine.handle.export.import "17.13.4.4Export/import"), export/importconstexpr void* address() const noexcept; static constexpr coroutine_handle from_address(void* addr); // [[coroutine.handle.observers]](coroutine.handle.observers "17.13.4.5Observers"), observersconstexpr explicit operator bool() const noexcept; bool done() const; // [[coroutine.handle.resumption]](coroutine.handle.resumption "17.13.4.6Resumption"), resumptionvoid operator()() const; void resume() const; void destroy() const; private:void* ptr; // *exposition only*}; template<class Promise>struct coroutine_handle {// [[coroutine.handle.con]](coroutine.handle.con "17.13.4.2Construct/reset"), construct/resetconstexpr coroutine_handle() noexcept; constexpr coroutine_handle(nullptr_t) noexcept; static coroutine_handle from_promise(Promise&);
coroutine_handle& operator=(nullptr_t) noexcept; // [[coroutine.handle.export.import]](coroutine.handle.export.import "17.13.4.4Export/import"), export/importconstexpr void* address() const noexcept; static constexpr coroutine_handle from_address(void* addr); // [[coroutine.handle.conv]](coroutine.handle.conv "17.13.4.3Conversion"), conversionconstexpr operator coroutine_handle<>() const noexcept; // [[coroutine.handle.observers]](coroutine.handle.observers "17.13.4.5Observers"), observersconstexpr explicit operator bool() const noexcept; bool done() const; // [[coroutine.handle.resumption]](coroutine.handle.resumption "17.13.4.6Resumption"), resumptionvoid operator()() const; void resume() const; void destroy() const; // [[coroutine.handle.promise]](coroutine.handle.promise "17.13.4.7Promise access"), promise access Promise& promise() const; private:void* ptr; // *exposition only*};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5892)
An object of typecoroutine_handle<T> is called a [*coroutine handle*](#def:coroutine_handle) and can be used to refer to a suspended or executing coroutine[.](#1.sentence-1)
A coroutine_handle object whose
member address() returns a null pointer value
does not refer to any
coroutine[.](#1.sentence-2)
Two coroutine_handle objects refer to the same coroutine
if and only if their member address() returns the same non-null value[.](#1.sentence-3)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5903)
If a program declares an explicit or partial specialization ofcoroutine_handle, the behavior is undefined[.](#2.sentence-1)

View File

@@ -0,0 +1,20 @@
[coroutine.handle.hash]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.hash)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#hash)
#### 17.13.4.9 Hash support [coroutine.handle.hash]
[🔗](#lib:hash,coroutine_handle)
`template<class P> struct hash<coroutine_handle<P>>;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6144)
The specialization is enabled ([[unord.hash]](unord.hash "22.10.19Class template hash"))[.](#1.sentence-1)

View File

@@ -0,0 +1,109 @@
[coroutine.handle.noop]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [coroutine.handle.noop]
#### [17.13.5.2.1](#general) General [[coroutine.handle.noop.general]](coroutine.handle.noop.general)
[🔗](#lib:coroutine_handle%3cnoop_coroutine_promise%3e)
namespace std {template<>struct coroutine_handle<noop_coroutine_promise>{// [[coroutine.handle.noop.conv]](#conv "17.13.5.2.2Conversion"), conversionconstexpr operator coroutine_handle<>() const noexcept; // [[coroutine.handle.noop.observers]](#observers "17.13.5.2.3Observers"), observersconstexpr explicit operator bool() const noexcept; constexpr bool done() const noexcept; // [[coroutine.handle.noop.resumption]](#resumption "17.13.5.2.4Resumption"), resumptionconstexpr void operator()() const noexcept; constexpr void resume() const noexcept; constexpr void destroy() const noexcept; // [[coroutine.handle.noop.promise]](#promise "17.13.5.2.5Promise access"), promise access noop_coroutine_promise& promise() const noexcept; // [[coroutine.handle.noop.address]](#address "17.13.5.2.6Address"), addressconstexpr void* address() const noexcept; private: coroutine_handle(*unspecified*); void* ptr; // *exposition only*};}
#### [17.13.5.2.2](#conv) Conversion [[coroutine.handle.noop.conv]](coroutine.handle.noop.conv)
[🔗](#lib:operator_coroutine_handle%3c%3e,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr operator coroutine_handle<>() const noexcept;
`
[1](#conv-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6206)
*Effects*: Equivalent to: return coroutine_handle<>::from_address(address());
#### [17.13.5.2.3](#observers) Observers [[coroutine.handle.noop.observers]](coroutine.handle.noop.observers)
[🔗](#lib:operator_bool,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr explicit operator bool() const noexcept;
`
[1](#observers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6219)
*Returns*: true[.](#observers-1.sentence-1)
[🔗](#lib:done,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr bool done() const noexcept;
`
[2](#observers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6230)
*Returns*: false[.](#observers-2.sentence-1)
#### [17.13.5.2.4](#resumption) Resumption [[coroutine.handle.noop.resumption]](coroutine.handle.noop.resumption)
[🔗](#lib:operator(),coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void operator()() const noexcept;
constexpr void resume() const noexcept;
constexpr void destroy() const noexcept;
`
[1](#resumption-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6247)
*Effects*: None[.](#resumption-1.sentence-1)
[2](#resumption-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6251)
*Remarks*: If noop_coroutine_handle is converted to coroutine_handle<>,
calls to operator(), resume and destroy on that handle
will also have no observable effects[.](#resumption-2.sentence-1)
#### [17.13.5.2.5](#promise) Promise access [[coroutine.handle.noop.promise]](coroutine.handle.noop.promise)
[🔗](#lib:promise,coroutine_handle%3cnoop_coroutine_promise%3e)
`noop_coroutine_promise& promise() const noexcept;
`
[1](#promise-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6266)
*Returns*: A reference to the promise object associated with this
coroutine handle[.](#promise-1.sentence-1)
#### [17.13.5.2.6](#address) Address [[coroutine.handle.noop.address]](coroutine.handle.noop.address)
[🔗](#lib:address,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void* address() const noexcept;
`
[1](#address-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6280)
*Returns*: ptr[.](#address-1.sentence-1)
[2](#address-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6284)
*Remarks*: A noop_coroutine_handle's ptr is always a
non-null pointer value[.](#address-2.sentence-1)

View File

@@ -0,0 +1,29 @@
[coroutine.handle.noop.address]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.address)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.address)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#address)
#### 17.13.5.2.6 Address [coroutine.handle.noop.address]
[🔗](#lib:address,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void* address() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6280)
*Returns*: ptr[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6284)
*Remarks*: A noop_coroutine_handle's ptr is always a
non-null pointer value[.](#2.sentence-1)

View File

@@ -0,0 +1,22 @@
[coroutine.handle.noop.conv]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.conv)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.conv)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#conv)
#### 17.13.5.2.2 Conversion [coroutine.handle.noop.conv]
[🔗](#lib:operator_coroutine_handle%3c%3e,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr operator coroutine_handle<>() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6206)
*Effects*: Equivalent to: return coroutine_handle<>::from_address(address());

View File

@@ -0,0 +1,15 @@
[coroutine.handle.noop.general]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.general)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.general)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#general)
#### 17.13.5.2.1 General [coroutine.handle.noop.general]
[🔗](#lib:coroutine_handle%3cnoop_coroutine_promise%3e)
namespace std {template<>struct coroutine_handle<noop_coroutine_promise>{// [[coroutine.handle.noop.conv]](coroutine.handle.noop.conv "17.13.5.2.2Conversion"), conversionconstexpr operator coroutine_handle<>() const noexcept; // [[coroutine.handle.noop.observers]](coroutine.handle.noop.observers "17.13.5.2.3Observers"), observersconstexpr explicit operator bool() const noexcept; constexpr bool done() const noexcept; // [[coroutine.handle.noop.resumption]](coroutine.handle.noop.resumption "17.13.5.2.4Resumption"), resumptionconstexpr void operator()() const noexcept; constexpr void resume() const noexcept; constexpr void destroy() const noexcept; // [[coroutine.handle.noop.promise]](coroutine.handle.noop.promise "17.13.5.2.5Promise access"), promise access noop_coroutine_promise& promise() const noexcept; // [[coroutine.handle.noop.address]](coroutine.handle.noop.address "17.13.5.2.6Address"), addressconstexpr void* address() const noexcept; private: coroutine_handle(*unspecified*); void* ptr; // *exposition only*};}

View File

@@ -0,0 +1,33 @@
[coroutine.handle.noop.observers]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.observers)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.observers)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#observers)
#### 17.13.5.2.3 Observers [coroutine.handle.noop.observers]
[🔗](#lib:operator_bool,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr explicit operator bool() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6219)
*Returns*: true[.](#1.sentence-1)
[🔗](#lib:done,coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr bool done() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6230)
*Returns*: false[.](#2.sentence-1)

View File

@@ -0,0 +1,23 @@
[coroutine.handle.noop.promise]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.promise)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.promise)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#promise)
#### 17.13.5.2.5 Promise access [coroutine.handle.noop.promise]
[🔗](#lib:promise,coroutine_handle%3cnoop_coroutine_promise%3e)
`noop_coroutine_promise& promise() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6266)
*Returns*: A reference to the promise object associated with this
coroutine handle[.](#1.sentence-1)

View File

@@ -0,0 +1,32 @@
[coroutine.handle.noop.resumption]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.noop.resumption)
### 17.13.5 No-op coroutines [[coroutine.noop]](coroutine.noop#coroutine.handle.noop.resumption)
#### 17.13.5.2 Class coroutine_handle<noop_coroutine_promise> [[coroutine.handle.noop]](coroutine.handle.noop#resumption)
#### 17.13.5.2.4 Resumption [coroutine.handle.noop.resumption]
[🔗](#lib:operator(),coroutine_handle%3cnoop_coroutine_promise%3e)
`constexpr void operator()() const noexcept;
constexpr void resume() const noexcept;
constexpr void destroy() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6247)
*Effects*: None[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6251)
*Remarks*: If noop_coroutine_handle is converted to coroutine_handle<>,
calls to operator(), resume and destroy on that handle
will also have no observable effects[.](#2.sentence-1)

View File

@@ -0,0 +1,38 @@
[coroutine.handle.observers]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.observers)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#observers)
#### 17.13.4.5 Observers [coroutine.handle.observers]
[🔗](#lib:operator_bool,coroutine_handle)
`constexpr explicit operator bool() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6021)
*Returns*: address() != nullptr[.](#1.sentence-1)
[🔗](#lib:done,coroutine_handle)
`bool done() const;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6032)
*Preconditions*: *this refers to a suspended coroutine[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6036)
*Returns*: true if the coroutine is suspended at its
final suspend point, otherwise false[.](#3.sentence-1)

View File

@@ -0,0 +1,26 @@
[coroutine.handle.promise]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.promise)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#promise)
#### 17.13.4.7 Promise access [coroutine.handle.promise]
[🔗](#lib:promise,coroutine_handle)
`Promise& promise() const;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6102)
*Preconditions*: *this refers to a coroutine[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6106)
*Returns*: A reference to the promise of the coroutine[.](#2.sentence-1)

View File

@@ -0,0 +1,71 @@
[coroutine.handle.resumption]
# 17 Language support library [[support]](./#support)
## 17.13 Coroutines [[support.coroutine]](support.coroutine#coroutine.handle.resumption)
### 17.13.4 Class template coroutine_handle [[coroutine.handle]](coroutine.handle#resumption)
#### 17.13.4.6 Resumption [coroutine.handle.resumption]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6044)
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[.](#1.sentence-1)
[*Note [1](#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[.](#1.sentence-2)
— *end note*]
[*Note [2](#note-2)*:
A concurrent resumption of the coroutine can result in a data race[.](#1.sentence-3)
— *end note*]
[🔗](#lib:operator(),coroutine_handle)
`void operator()() const;
void resume() const;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6069)
*Preconditions*: *this refers to a suspended coroutine[.](#2.sentence-1)
The coroutine is not suspended at its final suspend point[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6074)
*Effects*: Resumes the execution of the coroutine[.](#3.sentence-1)
[🔗](#lib:destroy,coroutine_handle)
`void destroy() const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6085)
*Preconditions*: *this refers to a suspended coroutine[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L6089)
*Effects*: Destroys the coroutine ([[dcl.fct.def.coroutine]](dcl.fct.def.coroutine "9.6.4Coroutine definitions"))[.](#5.sentence-1)