tmp/tmp6uyp_6ra/{from.md → to.md}
RENAMED
|
@@ -23,11 +23,10 @@ namespace std {
|
|
| 23 |
// setting the result
|
| 24 |
void set_value(see below);
|
| 25 |
void set_exception(exception_ptr p);
|
| 26 |
|
| 27 |
// setting the result with deferred notification
|
| 28 |
-
void set_value_at_thread_exit(const R& r);
|
| 29 |
void set_value_at_thread_exit(see below);
|
| 30 |
void set_exception_at_thread_exit(exception_ptr p);
|
| 31 |
};
|
| 32 |
template <class R>
|
| 33 |
void swap(promise<R>& x, promise<R>& y) noexcept;
|
|
@@ -36,12 +35,12 @@ namespace std {
|
|
| 36 |
}
|
| 37 |
```
|
| 38 |
|
| 39 |
The implementation shall provide the template `promise` and two
|
| 40 |
specializations, `promise<R&>` and `promise<{}void>`. These differ only
|
| 41 |
-
in the argument type of the member
|
| 42 |
-
|
| 43 |
|
| 44 |
The `set_value`, `set_exception`, `set_value_at_thread_exit`, and
|
| 45 |
`set_exception_at_thread_exit` member functions behave as though they
|
| 46 |
acquire a single mutex associated with the promise object while updating
|
| 47 |
the promise object.
|
|
@@ -69,11 +68,11 @@ promise(promise&& rhs) noexcept;
|
|
| 69 |
```
|
| 70 |
|
| 71 |
*Effects:* constructs a new `promise` object and transfers ownership of
|
| 72 |
the shared state of `rhs` (if any) to the newly-constructed object.
|
| 73 |
|
| 74 |
-
`rhs` has no shared state.
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
~promise();
|
| 78 |
```
|
| 79 |
|
|
@@ -92,13 +91,13 @@ promise& operator=(promise&& rhs) noexcept;
|
|
| 92 |
void swap(promise& other) noexcept;
|
| 93 |
```
|
| 94 |
|
| 95 |
*Effects:* Exchanges the shared state of `*this` and `other`.
|
| 96 |
|
| 97 |
-
`*this` has the shared state (if any) that `other` had
|
| 98 |
-
to `swap`. `other` has the shared state (if any) that
|
| 99 |
-
to the call to `swap`.
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
future<R> get_future();
|
| 103 |
```
|
| 104 |
|
|
@@ -119,11 +118,11 @@ void promise::set_value(const R& r);
|
|
| 119 |
void promise::set_value(R&& r);
|
| 120 |
void promise<R&>::set_value(R& r);
|
| 121 |
void promise<void>::set_value();
|
| 122 |
```
|
| 123 |
|
| 124 |
-
*Effects:*
|
| 125 |
that state ready ([[futures.state]]).
|
| 126 |
|
| 127 |
*Throws:*
|
| 128 |
|
| 129 |
- `future_error` if its shared state already has a stored value or
|
|
@@ -141,11 +140,13 @@ that state ready ([[futures.state]]).
|
|
| 141 |
|
| 142 |
``` cpp
|
| 143 |
void set_exception(exception_ptr p);
|
| 144 |
```
|
| 145 |
|
| 146 |
-
*
|
|
|
|
|
|
|
| 147 |
state and makes that state ready ([[futures.state]]).
|
| 148 |
|
| 149 |
*Throws:* `future_error` if its shared state already has a stored value
|
| 150 |
or exception.
|
| 151 |
|
|
@@ -184,10 +185,12 @@ associated with the current thread have been destroyed.
|
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
void set_exception_at_thread_exit(exception_ptr p);
|
| 187 |
```
|
| 188 |
|
|
|
|
|
|
|
| 189 |
*Effects:* Stores the exception pointer `p` in the shared state without
|
| 190 |
making that state ready immediately. Schedules that state to be made
|
| 191 |
ready when the current thread exits, after all objects of thread storage
|
| 192 |
duration associated with the current thread have been destroyed.
|
| 193 |
|
|
@@ -199,10 +202,10 @@ duration associated with the current thread have been destroyed.
|
|
| 199 |
value or exception.
|
| 200 |
- `no_state` if `*this` has no shared state.
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
template <class R>
|
| 204 |
-
void swap(promise<R>& x, promise<R>& y);
|
| 205 |
```
|
| 206 |
|
| 207 |
-
*Effects:* `x.swap(y)`.
|
| 208 |
|
|
|
|
| 23 |
// setting the result
|
| 24 |
void set_value(see below);
|
| 25 |
void set_exception(exception_ptr p);
|
| 26 |
|
| 27 |
// setting the result with deferred notification
|
|
|
|
| 28 |
void set_value_at_thread_exit(see below);
|
| 29 |
void set_exception_at_thread_exit(exception_ptr p);
|
| 30 |
};
|
| 31 |
template <class R>
|
| 32 |
void swap(promise<R>& x, promise<R>& y) noexcept;
|
|
|
|
| 35 |
}
|
| 36 |
```
|
| 37 |
|
| 38 |
The implementation shall provide the template `promise` and two
|
| 39 |
specializations, `promise<R&>` and `promise<{}void>`. These differ only
|
| 40 |
+
in the argument type of the member functions `set_value` and
|
| 41 |
+
`set_value_at_thread_exit`, as set out in their descriptions, below.
|
| 42 |
|
| 43 |
The `set_value`, `set_exception`, `set_value_at_thread_exit`, and
|
| 44 |
`set_exception_at_thread_exit` member functions behave as though they
|
| 45 |
acquire a single mutex associated with the promise object while updating
|
| 46 |
the promise object.
|
|
|
|
| 68 |
```
|
| 69 |
|
| 70 |
*Effects:* constructs a new `promise` object and transfers ownership of
|
| 71 |
the shared state of `rhs` (if any) to the newly-constructed object.
|
| 72 |
|
| 73 |
+
*Postconditions:* `rhs` has no shared state.
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
~promise();
|
| 77 |
```
|
| 78 |
|
|
|
|
| 91 |
void swap(promise& other) noexcept;
|
| 92 |
```
|
| 93 |
|
| 94 |
*Effects:* Exchanges the shared state of `*this` and `other`.
|
| 95 |
|
| 96 |
+
*Postconditions:* `*this` has the shared state (if any) that `other` had
|
| 97 |
+
prior to the call to `swap`. `other` has the shared state (if any) that
|
| 98 |
+
`*this` had prior to the call to `swap`.
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
future<R> get_future();
|
| 102 |
```
|
| 103 |
|
|
|
|
| 118 |
void promise::set_value(R&& r);
|
| 119 |
void promise<R&>::set_value(R& r);
|
| 120 |
void promise<void>::set_value();
|
| 121 |
```
|
| 122 |
|
| 123 |
+
*Effects:* Atomically stores the value `r` in the shared state and makes
|
| 124 |
that state ready ([[futures.state]]).
|
| 125 |
|
| 126 |
*Throws:*
|
| 127 |
|
| 128 |
- `future_error` if its shared state already has a stored value or
|
|
|
|
| 140 |
|
| 141 |
``` cpp
|
| 142 |
void set_exception(exception_ptr p);
|
| 143 |
```
|
| 144 |
|
| 145 |
+
*Requires:* `p` is not null.
|
| 146 |
+
|
| 147 |
+
*Effects:* Atomically stores the exception pointer `p` in the shared
|
| 148 |
state and makes that state ready ([[futures.state]]).
|
| 149 |
|
| 150 |
*Throws:* `future_error` if its shared state already has a stored value
|
| 151 |
or exception.
|
| 152 |
|
|
|
|
| 185 |
|
| 186 |
``` cpp
|
| 187 |
void set_exception_at_thread_exit(exception_ptr p);
|
| 188 |
```
|
| 189 |
|
| 190 |
+
*Requires:* `p` is not null.
|
| 191 |
+
|
| 192 |
*Effects:* Stores the exception pointer `p` in the shared state without
|
| 193 |
making that state ready immediately. Schedules that state to be made
|
| 194 |
ready when the current thread exits, after all objects of thread storage
|
| 195 |
duration associated with the current thread have been destroyed.
|
| 196 |
|
|
|
|
| 202 |
value or exception.
|
| 203 |
- `no_state` if `*this` has no shared state.
|
| 204 |
|
| 205 |
``` cpp
|
| 206 |
template <class R>
|
| 207 |
+
void swap(promise<R>& x, promise<R>& y) noexcept;
|
| 208 |
```
|
| 209 |
|
| 210 |
+
*Effects:* As if by `x.swap(y)`.
|
| 211 |
|