1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-05 16:10:31 +02:00

Explain iff in mutex.md (#810)

---------

Co-authored-by: Martin Geisler <martin@geisler.net>
This commit is contained in:
LIU JIE 2023-06-13 20:56:42 +08:00 committed by GitHub
parent 19780b832c
commit cf0ce5c0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ implementation.
* It is not possible to forget to acquire the mutex before accessing the protected data.
* You can get an `&mut T` from an `&Mutex<T>` by taking the lock. The `MutexGuard` ensures that the
`&mut T` doesn't outlive the lock being held.
* `Mutex<T>` implements both `Send` and `Sync` iff `T` implements `Send`.
* `Mutex<T>` implements both `Send` and `Sync` iff (if and only if) `T` implements `Send`.
* A read-write lock counterpart - `RwLock`.
* Why does `lock()` return a `Result`?
* If the thread that held the `Mutex` panicked, the `Mutex` becomes "poisoned" to signal that