diff options
| author | Poliorcetics <poliorcetics@users.noreply.github.com> | 2020-06-13 18:41:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-13 18:41:01 +0200 |
| commit | f747073fc1751afd2cfd4395283a4822b618f2da (patch) | |
| tree | a36a0f4b85a261218a7308b6d68ffb19aa1afe86 /src/libstd | |
| parent | 1312d30a6a837f72c3f36f5dc1c575a29890aa2c (diff) | |
| download | rust-f747073fc1751afd2cfd4395283a4822b618f2da.tar.gz rust-f747073fc1751afd2cfd4395283a4822b618f2da.zip | |
Apply suggestions from code review
Co-authored-by: David Tolnay <dtolnay@gmail.com>
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sync/mutex.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index b3ef521d6ec..6625d4659dc 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -108,8 +108,8 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; /// *guard += 1; /// ``` /// -/// It is sometimes a good idea (or even necessary) to manually drop the mutex -/// to unlock it as soon as possible. If you need the resource until the end of +/// It is sometimes necessary to manually drop the mutex +/// guard to unlock it as soon as possible. If you need the resource until the end of /// the scope, this is not needed. /// /// ``` @@ -140,16 +140,16 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; /// // This is the result of some important and long-ish work. /// let result = data.iter().fold(0, |acc, x| acc + x * 2); /// data.push(result); -/// // We drop the `data` explicitely because it's not necessary anymore +/// // We drop the `data` explicitly because it's not necessary anymore /// // and the thread still has work to do. This allow other threads to /// // start working on the data immediately, without waiting /// // for the rest of the unrelated work to be done here. /// // /// // It's even more important here than in the threads because we `.join` the -/// // threads after that. If we had not dropped the lock, a thread could be +/// // threads after that. If we had not dropped the mutex guard, a thread could be /// // waiting forever for it, causing a deadlock. /// drop(data); -/// // Here the lock is not assigned to a variable and so, even if the scope +/// // Here the mutex guard is not assigned to a variable and so, even if the scope /// // does not end after this line, the mutex is still released: /// // there is no deadlock. /// *res_mutex.lock().unwrap() += result; |
