]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: call atomic.Storeuintptr in noteclear on AIX
authorClément Chigot <clement.chigot@atos.net>
Mon, 25 Feb 2019 08:44:33 +0000 (09:44 +0100)
committerIan Lance Taylor <iant@golang.org>
Tue, 14 May 2019 15:01:49 +0000 (15:01 +0000)
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>
src/runtime/lock_sema.go

index fcc531ce78c67459b502b8787efc7f3241a3a7d7..b36c97f71e873098bf3802c8d61268079f7cbca8 100644 (file)
@@ -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) {