Skip to content

Commit

Permalink
Clarify how MutexGuard is 'thread-safe' (avoiding the vague term) (g…
Browse files Browse the repository at this point in the history
…oogle#2336)

Fixes the last outstanding point of google#1640.
  • Loading branch information
fw-immunant authored Sep 3, 2024
1 parent 345e782 commit c223257
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/concurrency/send-sync/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down

0 comments on commit c223257

Please sign in to comment.