]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: convert solaris netpollWakeSig to atomic type
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 17 Aug 2022 09:19:55 +0000 (16:19 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 17 Aug 2022 17:39:40 +0000 (17:39 +0000)
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>
src/runtime/netpoll_solaris.go

index ec51771b579acd0f8ac04418eb9195f074d687b9..d835cd9bf09c3715d075713db9efde3caa888a4b 100644 (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
                }