@@ -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 necessary to manually drop the mutex guard
112
- /// to unlock it sooner than the end of the enclosing scope.
111
+ /// It is sometimes necessary to manually drop the mutex guard to unlock it
112
+ /// sooner than the end of the enclosing scope.
113
113
///
114
114
/// ```
115
115
/// use std::sync::{Arc, Mutex};
@@ -139,18 +139,18 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
139
139
/// // This is the result of some important and long-ish work.
140
140
/// let result = data.iter().fold(0, |acc, x| acc + x * 2);
141
141
/// data.push(result);
142
- /// // We drop the `data` explicitly because it's not necessary anymore
143
- /// // and the thread still has work to do. This allow other threads to
144
- /// // start working on the data immediately, without waiting
145
- /// // for the rest of the unrelated work to be done here.
142
+ /// // We drop the `data` explicitly because it's not necessary anymore and the
143
+ /// // thread still has work to do. This allow other threads to start working on
144
+ /// // the data immediately, without waiting for the rest of the unrelated work
145
+ /// // to be done here.
146
146
/// //
147
147
/// // It's even more important here than in the threads because we `.join` the
148
- /// // threads after that. If we had not dropped the mutex guard, a thread could be
149
- /// // waiting forever for it, causing a deadlock.
148
+ /// // threads after that. If we had not dropped the mutex guard, a thread could
149
+ /// // be waiting forever for it, causing a deadlock.
150
150
/// drop(data);
151
- /// // Here the mutex guard is not assigned to a variable and so, even if the scope
152
- /// // does not end after this line, the mutex is still released:
153
- /// // there is no deadlock.
151
+ /// // Here the mutex guard is not assigned to a variable and so, even if the
152
+ /// // scope does not end after this line, the mutex is still released: there is
153
+ /// // no deadlock.
154
154
/// *res_mutex.lock().unwrap() += result;
155
155
///
156
156
/// threads.into_iter().for_each(|thread| {
0 commit comments