diff --git a/src/runtime/netpoll_epoll.go b/src/runtime/netpoll_epoll.go index 7ad2c8ab35..09da662c92 100644 --- a/src/runtime/netpoll_epoll.go +++ b/src/runtime/netpoll_epoll.go @@ -26,7 +26,7 @@ var ( netpollBreakRd, netpollBreakWr uintptr // for netpollBreak - netpollWakeSig uint32 // used to avoid duplicate calls of netpollBreak + netpollWakeSig atomic.Uint32 // used to avoid duplicate calls of netpollBreak ) func netpollinit() { @@ -80,7 +80,7 @@ func netpollarm(pd *pollDesc, mode int) { // netpollBreak interrupts an epollwait. 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 } @@ -157,7 +157,7 @@ retry: // if blocking. var tmp [16]byte read(int32(netpollBreakRd), noescape(unsafe.Pointer(&tmp[0])), int32(len(tmp))) - atomic.Store(&netpollWakeSig, 0) + netpollWakeSig.Store(0) } continue }