File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,19 @@ use crate::sys_common::rwlock as sys;
2525/// system's implementation, and this type does not guarantee that any
2626/// particular policy will be used. In particular, a writer which is waiting to
2727/// acquire the lock in `write` might or might not block concurrent calls to
28- /// `read`.
28+ /// `read`, e.g.:
29+ ///
30+ /// <details><summary>Potential deadlock example</summary>
31+ ///
32+ /// ```text
33+ /// // Thread 1 | // Thread 2
34+ /// let _rg = lock.read(); |
35+ /// | // will block
36+ /// | let _wg = lock.write();
37+ /// // may deadlock |
38+ /// let _rg = lock.read(); |
39+ /// ```
40+ /// </details>
2941///
3042/// The type parameter `T` represents the data that this lock protects. It is
3143/// required that `T` satisfies [`Send`] to be shared across threads and
You can’t perform that action at this time.
0 commit comments