Skip to content

Commit

Permalink
runtime: call atomic.Storeuintptr in noteclear on AIX
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
Clément Chigot authored and ianlancetaylor committed May 14, 2019
1 parent 46e03c4 commit 1956b28
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/runtime/lock_sema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1956b28

Please sign in to comment.