Skip to content

Commit c876c65

Browse files
committed
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.
1 parent e34c7e5 commit c876c65

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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)