aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/lock_sema.go
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2019-02-25 09:44:33 +0100
committerIan Lance Taylor <iant@golang.org>2019-05-14 15:01:49 +0000
commit1956b28ae3cf5e75fd8ad193d3ceec183581844b (patch)
tree4fa6d3d55d1593c796697da42c4983096618841e /src/runtime/lock_sema.go
parent46e03c4b92231a38e089b34f6a09707676216b48 (diff)
downloadgo-1956b28ae3cf5e75fd8ad193d3ceec183581844b.tar.gz
go-1956b28ae3cf5e75fd8ad193d3ceec183581844b.zip
runtime: call atomic.Storeuintptr in noteclear on AIX
The memory might not be synchronized in a thread being woken up after a semasleep. Using atomic instructions in noteclear function will force this synchronisation. Fixes #30189 Change-Id: If7432f29b2a1a56288231822db52f3f8d1d6dbfe Reviewed-on: https://go-review.googlesource.com/c/go/+/163624 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/lock_sema.go')
-rw-r--r--src/runtime/lock_sema.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/lock_sema.go b/src/runtime/lock_sema.go
index fcc531ce78..b36c97f71e 100644
--- a/src/runtime/lock_sema.go
+++ b/src/runtime/lock_sema.go
@@ -122,7 +122,13 @@ func unlock(l *mutex) {
// One-time notifications.
func noteclear(n *note) {
- n.key = 0
+ if GOOS == "aix" {
+ // On AIX, semaphores might not synchronize the memory in some
+ // rare cases. See issue #30189.
+ atomic.Storeuintptr(&n.key, 0)
+ } else {
+ n.key = 0
+ }
}
func notewakeup(n *note) {