@@ -44,10 +44,10 @@ struct Waiter;
44
44
*
45
45
* The thread that intends to wait on a ConditionVariable must:
46
46
* - Acquire a lock on a mutex
47
- * - Execute `wait`, `wait_for`, or `wait_until`. While the thread is waiting,
47
+ * - Execute `wait`, `wait_for` or `wait_until`. While the thread is waiting,
48
48
* the mutex will be unlocked.
49
49
* - When the condition variable has been notified, or in the case of `wait_for`
50
- * and `wait_until` the timeout expires the thread is awakened.
50
+ * and `wait_until` the timeout expires, the thread is awakened.
51
51
*
52
52
* The thread that intends to notify a ConditionVariable must:
53
53
* - Acquire a lock on the mutex used to construct the condition variable.
@@ -58,26 +58,26 @@ struct Waiter;
58
58
* ConditionVariable::notify_all is called.
59
59
* - At least one thread that is waiting on the condition variable will wake
60
60
* when ConditionVariable::notify_one is called.
61
- * - While waiting for a thread is waiting for notification of a
62
- * ConditionVariable it will release the lock held on the mutex.
61
+ * - While a thread is waiting for notification of a
62
+ * ConditionVariable, it will release the lock held on the mutex.
63
63
* - The ConditionVariable will reacquire the mutex lock before exiting the wait
64
64
* function.
65
65
*
66
66
* ## Undefined behavior
67
- * - The thread which is unblocked on ConditionVariable::notify_one is
67
+ * - The thread that is unblocked on ConditionVariable::notify_one is
68
68
* undefined if there are multiple waiters.
69
69
* - Calling wait if the mutex is not locked by the current thread is undefined
70
70
* behavior.
71
71
* - The order in which waiting threads acquire the condition variable's
72
72
* mutex after ConditionVariable::notify_all is called is undefined.
73
73
* - When ConditionVariable::notify_one or ConditionVariable::notify_all is
74
74
* called and there are one or more waiters, and one or more threads
75
- * attempting to acquire the condition variable's mutex the order in which the mutex is
75
+ * attempting to acquire the condition variable's mutex, the order in which the mutex is
76
76
* acquired is undefined.
77
77
* - The behavior of ConditionVariable::wait and ConditionVariable::wait_for
78
78
* is undefined if the condition variable's mutex is locked more than once by
79
79
* the calling thread.
80
- * - Spurious notifications (not triggered by the application) can occur
80
+ * - Spurious notifications (not triggered by the application) can occur,
81
81
* and it is not defined when these occur.
82
82
*
83
83
* @note Synchronization level: Thread safe
@@ -123,7 +123,7 @@ struct Waiter;
123
123
* // Acquire lock on mutex before modifying variables and notifying.
124
124
* mutex.lock();
125
125
*
126
- * // Change count and notify waiters of this
126
+ * // Change count and notify waiters of this.
127
127
* work_count++;
128
128
* printf("Main thread: Set count to: %lu\r\n", work_count);
129
129
* printf("Main thread: Notifying worker thread\r\n");
@@ -135,7 +135,7 @@ struct Waiter;
135
135
* wait(1.0);
136
136
* }
137
137
*
138
- * // Change done and notify waiters of this
138
+ * // Change done and notify waiters of this.
139
139
* mutex.lock();
140
140
* done = true;
141
141
* cv.notify_all();
@@ -150,22 +150,22 @@ struct Waiter;
150
150
151
151
class ConditionVariable : private mbed ::NonCopyable<ConditionVariable> {
152
152
public:
153
- /* * Create and initialize a ConditionVariable object
153
+ /* * Create and initialize a ConditionVariable object.
154
154
*
155
155
* @note You cannot call this function from ISR context.
156
156
*/
157
157
ConditionVariable (Mutex &mutex);
158
158
159
- /* * Wait for a notification
159
+ /* * Wait for a notification.
160
160
*
161
161
* Wait causes the current thread to block until the condition variable
162
162
* receives a notification from another thread.
163
163
*
164
164
* @note - The thread calling this function must be the owner of the
165
- * ConditionVariable's mutex and it must be locked exactly once.
165
+ * ConditionVariable's mutex, and it must be locked exactly once.
166
166
*
167
- * @note - Spurious notifications can occur so the caller of this API
168
- * should check to make sure the condition they are waiting on has
167
+ * @note - Spurious notifications can occur, so the caller of this API
168
+ * should check to make sure the condition the caller is waiting on has
169
169
* been met.
170
170
*
171
171
* @note - The current thread will release the lock while inside the wait
@@ -188,7 +188,7 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
188
188
*/
189
189
void wait ();
190
190
191
- /* * Wait for a notification until specified time
191
+ /* * Wait for a notification until the specified time.
192
192
*
193
193
* Wait until causes the current thread to block until the condition
194
194
* variable is notified, or a specific time given by millisec parameter is
@@ -198,10 +198,10 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
198
198
* @return true if a timeout occurred, false otherwise.
199
199
*
200
200
* @note - The thread calling this function must be the owner of the
201
- * ConditionVariable's mutex and it must be locked exactly once.
201
+ * ConditionVariable's mutex, and it must be locked exactly once.
202
202
*
203
- * @note - Spurious notifications can occur so the caller of this API
204
- * should check to make sure the condition they are waiting on has
203
+ * @note - Spurious notifications can occur, so the caller of this API
204
+ * should check to make sure the condition the caller is waiting on has
205
205
* been met.
206
206
*
207
207
* @note - The current thread will release the lock while inside the wait
@@ -235,14 +235,14 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
235
235
* variable receives a notification from another thread, or the timeout
236
236
* specified by the millisec parameter is reached.
237
237
*
238
- * @param millisec timeout value or osWaitForever in case of no time-out .
238
+ * @param millisec timeout value or osWaitForever in case of no timeout .
239
239
* @return true if a timeout occurred, false otherwise.
240
240
*
241
241
* @note - The thread calling this function must be the owner of the
242
- * ConditionVariable's mutex and it must be locked exactly once.
242
+ * ConditionVariable's mutex, and it must be locked exactly once.
243
243
*
244
- * @note - Spurious notifications can occur so the caller of this API
245
- * should check to make sure the condition they are waiting on has
244
+ * @note - Spurious notifications can occur, so the caller of this API
245
+ * should check to make sure the condition the caller is waiting on has
246
246
* been met.
247
247
*
248
248
* @note - The current thread will release the lock while inside the wait
@@ -276,9 +276,9 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
276
276
* variable.
277
277
*
278
278
* @note - The thread calling this function must be the owner of the
279
- * ConditionVariable's mutex
279
+ * ConditionVariable's mutex.
280
280
*
281
- * @note - The thread which is unblocked on ConditionVariable::notify_one is
281
+ * @note - The thread that is unblocked on ConditionVariable::notify_one is
282
282
* undefined if there are multiple waiters.
283
283
*
284
284
* @note You cannot call this function from ISR context.
@@ -291,7 +291,7 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
291
291
* variable.
292
292
*
293
293
* @note - The thread calling this function must be the owner of the
294
- * ConditionVariable's mutex
294
+ * ConditionVariable's mutex.
295
295
*
296
296
* @note - If there are one or more waiters and one or more threads
297
297
* attempting to acquire the condition variable's mutex the order in which
0 commit comments