aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-17 16:19:55 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-17 17:39:40 +0000
commitec8ed5bd026a79d661cc9f9c42dc044fd1c440ad (patch)
tree85c83afcbb63b19420d42e2bf57d0af933c806c5
parentce7aae5095c9f0c5ed2e4daddeac25a415cc370c (diff)
downloadgo-ec8ed5bd026a79d661cc9f9c42dc044fd1c440ad.tar.gz
go-ec8ed5bd026a79d661cc9f9c42dc044fd1c440ad.zip
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>
-rw-r--r--src/runtime/netpoll_solaris.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/netpoll_solaris.go b/src/runtime/netpoll_solaris.go
index ec51771b57..d835cd9bf0 100644
--- a/src/runtime/netpoll_solaris.go
+++ b/src/runtime/netpoll_solaris.go
@@ -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
}