diff options
| author | Sean Liao <sean@liao.dev> | 2024-12-03 22:41:38 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-12-04 02:44:30 +0000 |
| commit | bc0406333f686a754c2d787f93b143c27721925d (patch) | |
| tree | 78863b6f3e7f31f10ed50eadc1c7783ac3e5e4d0 /src | |
| parent | 2a0aeb12345e4ca64315830ffe87e57e1a828570 (diff) | |
| download | go-bc0406333f686a754c2d787f93b143c27721925d.tar.xz | |
sync: document RWMutex locks cannot be upgraded / downgraded
Fixes #38859
Change-Id: I9f4f6fa4cb529aaadfb3812e3a5c0da982a95f68
Reviewed-on: https://go-review.googlesource.com/c/go/+/633415
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/sync/rwmutex.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sync/rwmutex.go b/src/sync/rwmutex.go index 7fe096dbd8..3fbfd28d7f 100644 --- a/src/sync/rwmutex.go +++ b/src/sync/rwmutex.go @@ -24,6 +24,8 @@ import ( // 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. +// A [RWMutex.RLock] cannot be upgraded into a [RWMutex.Lock], +// nor can a [RWMutex.Lock] be downgraded into a [RWMutex.RLock]. // // In the terminology of [the Go memory model], // the n'th call to [RWMutex.Unlock] “synchronizes before” the m'th call to Lock |
