runtime: convert solaris netpollWakeSig to atomic type

Updates #53821

Change-Id: Ic2799c125267dc5b13b265db41fbe8bf7c08b8a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423878
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Cuong Manh Le 2022-08-17 16:19:55 +07:00
parent ce7aae5095
commit ec8ed5bd02
1 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ var (
libc_port_dissociate,
libc_port_getn,
libc_port_alert libcFunc
netpollWakeSig uint32 // used to avoid duplicate calls of netpollBreak
netpollWakeSig atomic.Uint32 // used to avoid duplicate calls of netpollBreak
)
func errno() int32 {
@ -192,7 +192,7 @@ func netpollarm(pd *pollDesc, mode int) {
// netpollBreak interrupts a port_getn wait.
func netpollBreak() {
// Failing to cas indicates there is an in-flight wakeup, so we're done here.
if !atomic.Cas(&netpollWakeSig, 0, 1) {
if !netpollWakeSig.CompareAndSwap(0, 1) {
return
}
@ -277,7 +277,7 @@ retry:
println("runtime: port_alert failed with", e)
throw("runtime: netpoll: port_alert failed")
}
atomic.Store(&netpollWakeSig, 0)
netpollWakeSig.Store(0)
}
continue
}