From c223257016c32c4596e045c7bd29c5c20e36e70f Mon Sep 17 00:00:00 2001 From: Frances Wingerter <91758128+fw-immunant@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:43:00 +0000 Subject: [PATCH] Clarify how `MutexGuard` is 'thread-safe' (avoiding the vague term) (#2336) Fixes the last outstanding point of #1640. --- src/concurrency/send-sync/examples.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/concurrency/send-sync/examples.md b/src/concurrency/send-sync/examples.md index d3074df3283..0a45ba82991 100644 --- a/src/concurrency/send-sync/examples.md +++ b/src/concurrency/send-sync/examples.md @@ -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`: 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`