]> Cypherpunks repositories - gostls13.git/commitdiff
sync: deemphasize goroutines in RWMutex documentation
authorqiulaidongfeng <2645477756@qq.com>
Tue, 15 Aug 2023 02:13:47 +0000 (02:13 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 7 Sep 2023 16:18:47 +0000 (16:18 +0000)
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>

src/sync/rwmutex.go

index 1317624035d307c8542d1b2ef930dd0b51877875..f445b66fd7b08c19c4fa060ea30c080717faa2ed 100644 (file)
@@ -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