aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2023-08-15 02:13:47 +0000
committerGopher Robot <gobot@golang.org>2023-09-07 16:18:47 +0000
commita35bb44adcc56e4ea8594e34723b7182ffa0035c (patch)
tree693b03bd1b38d728750ac1946fd8fcb18a7dad05 /src
parentdc6513b89f12768a4cc90925e383bd64240715ac (diff)
downloadgo-a35bb44adcc56e4ea8594e34723b7182ffa0035c.tar.xz
sync: deemphasize goroutines in RWMutex documentation
Fixes #41555 Change-Id: I46b9535b1687d481d2ac76296e8ba7de26d6e2e2 Change-Id: I46b9535b1687d481d2ac76296e8ba7de26d6e2e2 GitHub-Last-Rev: 38af46c18922eea80e05c8ed9f5e10002ab7244d GitHub-Pull-Request: golang/go#61977 Reviewed-on: https://go-review.googlesource.com/c/go/+/518859 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/sync/rwmutex.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sync/rwmutex.go b/src/sync/rwmutex.go
index 1317624035..f445b66fd7 100644
--- a/src/sync/rwmutex.go
+++ b/src/sync/rwmutex.go
@@ -19,12 +19,11 @@ import (
//
// A RWMutex must not be copied after first use.
//
-// If a goroutine holds a RWMutex for reading and another goroutine might
-// call Lock, no goroutine should expect to be able to acquire a read lock
-// until the initial read lock is released. In particular, this prohibits
-// recursive read locking. This is to ensure that the lock eventually becomes
-// available; a blocked Lock call excludes new readers from acquiring the
-// lock.
+// If any goroutine calls Lock while the lock is already held by
+// one or more readers, concurrent calls to RLock will block until
+// the writer has acquired (and released) the lock, to ensure that
+// the lock eventually becomes available to the writer.
+// Note that this prohibits recursive read-locking.
//
// In the terminology of the Go memory model,
// the n'th call to Unlock “synchronizes before” the m'th call to Lock