Skip to content

Commit 8ddfdf5

Browse files
author
Amanda Butler
authored
Copy edit ConditionVariable.h
Copy edit file, including existing text.
1 parent c86ceb1 commit 8ddfdf5

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

rtos/ConditionVariable.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ struct Waiter;
4444
*
4545
* The thread that intends to wait on a ConditionVariable must:
4646
* - 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,
4848
* the mutex will be unlocked.
4949
* - 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.
5151
*
5252
* The thread that intends to notify a ConditionVariable must:
5353
* - Acquire a lock on the mutex used to construct the condition variable.
@@ -58,26 +58,26 @@ struct Waiter;
5858
* ConditionVariable::notify_all is called.
5959
* - At least one thread that is waiting on the condition variable will wake
6060
* 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.
6363
* - The ConditionVariable will reacquire the mutex lock before exiting the wait
6464
* function.
6565
*
6666
* ## Undefined behavior
67-
* - The thread which is unblocked on ConditionVariable::notify_one is
67+
* - The thread that is unblocked on ConditionVariable::notify_one is
6868
* undefined if there are multiple waiters.
6969
* - Calling wait if the mutex is not locked by the current thread is undefined
7070
* behavior.
7171
* - The order in which waiting threads acquire the condition variable's
7272
* mutex after ConditionVariable::notify_all is called is undefined.
7373
* - When ConditionVariable::notify_one or ConditionVariable::notify_all is
7474
* 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
7676
* acquired is undefined.
7777
* - The behavior of ConditionVariable::wait and ConditionVariable::wait_for
7878
* is undefined if the condition variable's mutex is locked more than once by
7979
* the calling thread.
80-
* - Spurious notifications (not triggered by the application) can occur
80+
* - Spurious notifications (not triggered by the application) can occur,
8181
* and it is not defined when these occur.
8282
*
8383
* @note Synchronization level: Thread safe
@@ -123,7 +123,7 @@ struct Waiter;
123123
* // Acquire lock on mutex before modifying variables and notifying.
124124
* mutex.lock();
125125
*
126-
* // Change count and notify waiters of this
126+
* // Change count and notify waiters of this.
127127
* work_count++;
128128
* printf("Main thread: Set count to: %lu\r\n", work_count);
129129
* printf("Main thread: Notifying worker thread\r\n");
@@ -135,7 +135,7 @@ struct Waiter;
135135
* wait(1.0);
136136
* }
137137
*
138-
* // Change done and notify waiters of this
138+
* // Change done and notify waiters of this.
139139
* mutex.lock();
140140
* done = true;
141141
* cv.notify_all();
@@ -150,22 +150,22 @@ struct Waiter;
150150

151151
class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
152152
public:
153-
/** Create and initialize a ConditionVariable object
153+
/** Create and initialize a ConditionVariable object.
154154
*
155155
* @note You cannot call this function from ISR context.
156156
*/
157157
ConditionVariable(Mutex &mutex);
158158

159-
/** Wait for a notification
159+
/** Wait for a notification.
160160
*
161161
* Wait causes the current thread to block until the condition variable
162162
* receives a notification from another thread.
163163
*
164164
* @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.
166166
*
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
169169
* been met.
170170
*
171171
* @note - The current thread will release the lock while inside the wait
@@ -188,7 +188,7 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
188188
*/
189189
void wait();
190190

191-
/** Wait for a notification until specified time
191+
/** Wait for a notification until the specified time.
192192
*
193193
* Wait until causes the current thread to block until the condition
194194
* variable is notified, or a specific time given by millisec parameter is
@@ -198,10 +198,10 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
198198
* @return true if a timeout occurred, false otherwise.
199199
*
200200
* @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.
202202
*
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
205205
* been met.
206206
*
207207
* @note - The current thread will release the lock while inside the wait
@@ -235,14 +235,14 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
235235
* variable receives a notification from another thread, or the timeout
236236
* specified by the millisec parameter is reached.
237237
*
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.
239239
* @return true if a timeout occurred, false otherwise.
240240
*
241241
* @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.
243243
*
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
246246
* been met.
247247
*
248248
* @note - The current thread will release the lock while inside the wait
@@ -276,9 +276,9 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
276276
* variable.
277277
*
278278
* @note - The thread calling this function must be the owner of the
279-
* ConditionVariable's mutex
279+
* ConditionVariable's mutex.
280280
*
281-
* @note - The thread which is unblocked on ConditionVariable::notify_one is
281+
* @note - The thread that is unblocked on ConditionVariable::notify_one is
282282
* undefined if there are multiple waiters.
283283
*
284284
* @note You cannot call this function from ISR context.
@@ -291,7 +291,7 @@ class ConditionVariable : private mbed::NonCopyable<ConditionVariable> {
291291
* variable.
292292
*
293293
* @note - The thread calling this function must be the owner of the
294-
* ConditionVariable's mutex
294+
* ConditionVariable's mutex.
295295
*
296296
* @note - If there are one or more waiters and one or more threads
297297
* attempting to acquire the condition variable's mutex the order in which

0 commit comments

Comments
 (0)