From Jason Turner

[thread.condition.condvarany]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpabvl49sf/{from.md → to.md} +24 -45
tmp/tmpabvl49sf/{from.md → to.md} RENAMED
@@ -48,12 +48,12 @@ condition_variable_any();
48
  *Throws:* `bad_alloc` or `system_error` when an exception is
49
  required ([[thread.req.exception]]).
50
 
51
  *Error conditions:*
52
 
53
- - `resource_unavailable_try_again` — if any native handle type
54
- manipulated is not available.
55
  - `operation_not_permitted` — if the thread does not have the privilege
56
  to perform the operation.
57
 
58
  ``` cpp
59
  ~condition_variable_any();
@@ -98,28 +98,25 @@ allows to query that, such as the `unique_lock` wrapper.
98
  - Atomically calls `lock.unlock()` and blocks on `*this`.
99
  - When unblocked, calls `lock.lock()` (possibly blocking on the lock)
100
  and returns.
101
  - The function will unblock when signaled by a call to `notify_one()`, a
102
  call to `notify_all()`, or spuriously.
103
- - If the function exits via an exception, `lock.lock()` shall be called
104
- prior to exiting the function scope.
 
 
105
 
106
  `lock` is locked by the calling thread.
107
 
108
- *Throws:* `system_error` when an exception is
109
- required ([[thread.req.exception]]).
110
-
111
- *Error conditions:*
112
-
113
- - equivalent error condition from `lock.lock()` or `lock.unlock()`.
114
 
115
  ``` cpp
116
  template <class Lock, class Predicate>
117
  void wait(Lock& lock, Predicate pred);
118
  ```
119
 
120
- *Effects:*
121
 
122
  ``` cpp
123
  while (!pred())
124
  wait(lock);
125
  ```
@@ -137,91 +134,73 @@ template <class Lock, class Clock, class Duration>
137
  - The function will unblock when signaled by a call to `notify_one()`, a
138
  call to `notify_all()`, expiration of the absolute
139
  timeout ([[thread.req.timing]]) specified by `abs_time`, or
140
  spuriously.
141
  - If the function exits via an exception, `lock.lock()` shall be called
142
- prior to exiting the function scope.
 
 
 
 
143
 
144
  `lock` is locked by the calling thread.
145
 
146
  *Returns:* `cv_status::timeout` if the absolute
147
  timeout ([[thread.req.timing]]) specified by `abs_time` expired,
148
  otherwise `cv_status::no_timeout`.
149
 
150
- *Throws:* `system_error` when an exception is
151
- required ([[thread.req.exception]]).
152
-
153
- *Error conditions:*
154
-
155
- - equivalent error condition from `lock.lock()` or `lock.unlock()`.
156
 
157
  ``` cpp
158
  template <class Lock, class Rep, class Period>
159
  cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
160
  ```
161
 
162
- *Effects:* as if
163
 
164
  ``` cpp
165
  return wait_until(lock, chrono::steady_clock::now() + rel_time);
166
  ```
167
 
168
  *Returns:* `cv_status::timeout` if the relative
169
  timeout ([[thread.req.timing]]) specified by `rel_time` expired,
170
  otherwise `cv_status::no_timeout`.
171
 
 
 
 
 
172
  `lock` is locked by the calling thread.
173
 
174
- *Throws:* `system_error` when an exception is
175
- required ([[thread.req.exception]]).
176
-
177
- *Error conditions:*
178
-
179
- - equivalent error condition from `lock.lock()` or `lock.unlock()`.
180
 
181
  ``` cpp
182
  template <class Lock, class Clock, class Duration, class Predicate>
183
  bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
184
  ```
185
 
186
- *Effects:*
187
 
188
  ``` cpp
189
  while (!pred())
190
  if (wait_until(lock, abs_time) == cv_status::timeout)
191
  return pred();
192
  return true;
193
  ```
194
 
195
- *Returns:* `pred()`
 
196
 
197
  The returned value indicates whether the predicate evaluates to `true`
198
  regardless of whether the timeout was triggered.
199
 
200
  ``` cpp
201
  template <class Lock, class Rep, class Period, class Predicate>
202
  bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
203
  ```
204
 
205
- *Effects:* as if
206
 
207
  ``` cpp
208
  return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
209
  ```
210
 
211
- There is no blocking if `pred()` is initially `true`, even if the
212
- timeout has already expired.
213
-
214
- `lock` is locked by the calling thread.
215
-
216
- *Returns:* `pred()`
217
-
218
- The returned value indicates whether the predicate evaluates to `true`
219
- regardless of whether the timeout was triggered.
220
-
221
- *Throws:* `system_error` when an exception is
222
- required ([[thread.req.exception]]).
223
-
224
- *Error conditions:*
225
-
226
- - equivalent error condition from `lock.lock()` or `lock.unlock()`.
227
-
 
48
  *Throws:* `bad_alloc` or `system_error` when an exception is
49
  required ([[thread.req.exception]]).
50
 
51
  *Error conditions:*
52
 
53
+ - `resource_unavailable_try_again` — if some non-memory resource
54
+ limitation prevents initialization.
55
  - `operation_not_permitted` — if the thread does not have the privilege
56
  to perform the operation.
57
 
58
  ``` cpp
59
  ~condition_variable_any();
 
98
  - Atomically calls `lock.unlock()` and blocks on `*this`.
99
  - When unblocked, calls `lock.lock()` (possibly blocking on the lock)
100
  and returns.
101
  - The function will unblock when signaled by a call to `notify_one()`, a
102
  call to `notify_all()`, or spuriously.
103
+
104
+ *Remarks:* If the function fails to meet the postcondition,
105
+ `std::terminate()` shall be called ([[except.terminate]]). This can
106
+ happen if the re-locking of the mutex throws an exception.
107
 
108
  `lock` is locked by the calling thread.
109
 
110
+ *Throws:* Nothing.
 
 
 
 
 
111
 
112
  ``` cpp
113
  template <class Lock, class Predicate>
114
  void wait(Lock& lock, Predicate pred);
115
  ```
116
 
117
+ *Effects:* Equivalent to:
118
 
119
  ``` cpp
120
  while (!pred())
121
  wait(lock);
122
  ```
 
134
  - The function will unblock when signaled by a call to `notify_one()`, a
135
  call to `notify_all()`, expiration of the absolute
136
  timeout ([[thread.req.timing]]) specified by `abs_time`, or
137
  spuriously.
138
  - If the function exits via an exception, `lock.lock()` shall be called
139
+ prior to exiting the function.
140
+
141
+ *Remarks:* If the function fails to meet the postcondition,
142
+ `std::terminate()` shall be called ([[except.terminate]]). This can
143
+ happen if the re-locking of the mutex throws an exception.
144
 
145
  `lock` is locked by the calling thread.
146
 
147
  *Returns:* `cv_status::timeout` if the absolute
148
  timeout ([[thread.req.timing]]) specified by `abs_time` expired,
149
  otherwise `cv_status::no_timeout`.
150
 
151
+ *Throws:* Timeout-related exceptions ([[thread.req.timing]]).
 
 
 
 
 
152
 
153
  ``` cpp
154
  template <class Lock, class Rep, class Period>
155
  cv_status wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
156
  ```
157
 
158
+ *Effects:* Equivalent to:
159
 
160
  ``` cpp
161
  return wait_until(lock, chrono::steady_clock::now() + rel_time);
162
  ```
163
 
164
  *Returns:* `cv_status::timeout` if the relative
165
  timeout ([[thread.req.timing]]) specified by `rel_time` expired,
166
  otherwise `cv_status::no_timeout`.
167
 
168
+ *Remarks:* If the function fails to meet the postcondition,
169
+ `std::terminate()` shall be called ([[except.terminate]]). This can
170
+ happen if the re-locking of the mutex throws an exception.
171
+
172
  `lock` is locked by the calling thread.
173
 
174
+ *Throws:* Timeout-related exceptions ([[thread.req.timing]]).
 
 
 
 
 
175
 
176
  ``` cpp
177
  template <class Lock, class Clock, class Duration, class Predicate>
178
  bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time, Predicate pred);
179
  ```
180
 
181
+ *Effects:* Equivalent to:
182
 
183
  ``` cpp
184
  while (!pred())
185
  if (wait_until(lock, abs_time) == cv_status::timeout)
186
  return pred();
187
  return true;
188
  ```
189
 
190
+ There is no blocking if `pred()` is initially `true`, or if the timeout
191
+ has already expired.
192
 
193
  The returned value indicates whether the predicate evaluates to `true`
194
  regardless of whether the timeout was triggered.
195
 
196
  ``` cpp
197
  template <class Lock, class Rep, class Period, class Predicate>
198
  bool wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time, Predicate pred);
199
  ```
200
 
201
+ *Effects:* Equivalent to:
202
 
203
  ``` cpp
204
  return wait_until(lock, chrono::steady_clock::now() + rel_time, std::move(pred));
205
  ```
206