mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-21 06:36:31 +02:00
Clarify how MutexGuard
is 'thread-safe' (avoiding the vague term) (#2336)
Fixes the last outstanding point of #1640.
This commit is contained in:
parent
345e782bdd
commit
c223257016
@ -30,10 +30,12 @@ Typically because of interior mutability:
|
|||||||
|
|
||||||
## `!Send + Sync`
|
## `!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
|
- `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`
|
## `!Send + !Sync`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user