@@ -108,8 +108,8 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
108
108
/// *guard += 1;
109
109
/// ```
110
110
///
111
- /// It is sometimes a good idea (or even necessary) to manually drop the mutex
112
- /// to unlock it as soon as possible. If you need the resource until the end of
111
+ /// It is sometimes necessary to manually drop the mutex
112
+ /// guard to unlock it as soon as possible. If you need the resource until the end of
113
113
/// the scope, this is not needed.
114
114
///
115
115
/// ```
@@ -140,16 +140,16 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
140
140
/// // This is the result of some important and long-ish work.
141
141
/// let result = data.iter().fold(0, |acc, x| acc + x * 2);
142
142
/// data.push(result);
143
- /// // We drop the `data` explicitely because it's not necessary anymore
143
+ /// // We drop the `data` explicitly because it's not necessary anymore
144
144
/// // and the thread still has work to do. This allow other threads to
145
145
/// // start working on the data immediately, without waiting
146
146
/// // for the rest of the unrelated work to be done here.
147
147
/// //
148
148
/// // It's even more important here than in the threads because we `.join` the
149
- /// // threads after that. If we had not dropped the lock , a thread could be
149
+ /// // threads after that. If we had not dropped the mutex guard , a thread could be
150
150
/// // waiting forever for it, causing a deadlock.
151
151
/// drop(data);
152
- /// // Here the lock is not assigned to a variable and so, even if the scope
152
+ /// // Here the mutex guard is not assigned to a variable and so, even if the scope
153
153
/// // does not end after this line, the mutex is still released:
154
154
/// // there is no deadlock.
155
155
/// *res_mutex.lock().unwrap() += result;
0 commit comments