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 @@ -23,7 +23,19 @@ use crate::sys_common::rwlock as sys;
2323/// system's implementation, and this type does not guarantee that any
2424/// particular policy will be used. In particular, a writer which is waiting to
2525/// acquire the lock in `write` might or might not block concurrent calls to
26- /// `read`.
26+ /// `read`, e.g.:
27+ ///
28+ /// <details><summary>Potential deadlock example</summary>
29+ ///
30+ /// ```text
31+ /// // Thread 1 | // Thread 2
32+ /// let _rg = lock.read(); |
33+ /// | // will block
34+ /// | let _wg = lock.write();
35+ /// // may deadlock |
36+ /// let _rg = lock.read(); |
37+ /// ```
38+ /// </details>
2739///
2840/// The type parameter `T` represents the data that this lock protects. It is
2941/// required that `T` satisfies [`Send`] to be shared across threads and
You can’t perform that action at this time.
0 commit comments