1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-17 16:12:39 +02:00

Clarify how MutexGuard is 'thread-safe' (avoiding the vague term) ()

Fixes the last outstanding point of .
This commit is contained in:
Frances Wingerter 2024-09-03 13:43:00 +00:00 committed by GitHub
parent 345e782bdd
commit c223257016
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,10 +30,12 @@ Typically because of interior mutability:
## `!Send + Sync`
These types are thread-safe, but they cannot be moved to another thread:
These types are safe to access (via shared references) from multiple threads,
but they cannot be moved to another thread:
- `MutexGuard<T: Sync>`: Uses OS level primitives which must be deallocated on
the thread which created them.
the thread which created them. However, an already-locked mutex can have its
guarded variable read by any thread with which the guard is shared.
## `!Send + !Sync`