Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bce5253

Browse files
Rollup merge of rust-lang#123118 - tgross35:rwlock-docs, r=workingjubilee
Update `RwLock` deadlock example to not use shadowing Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
2 parents 19a40ec + 0cd5772 commit bce5253

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎library/std/src/sync/rwlock.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ use crate::sys::sync as sys;
3131
/// <details><summary>Potential deadlock example</summary>
3232
///
3333
/// ```text
34-
/// // Thread 1 | // Thread 2
35-
/// let _rg = lock.read(); |
36-
/// | // will block
37-
/// | let _wg = lock.write();
38-
/// // may deadlock |
39-
/// let _rg = lock.read(); |
34+
/// // Thread 1 | // Thread 2
35+
/// let _rg1 = lock.read(); |
36+
/// | // will block
37+
/// | let _wg = lock.write();
38+
/// // may deadlock |
39+
/// let _rg2 = lock.read(); |
4040
/// ```
41+
///
4142
/// </details>
4243
///
4344
/// The type parameter `T` represents the data that this lock protects. It is

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /