From 9b988c9094df18a75537f5c4ae12449062550290 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 17 Aug 2022 16:21:00 +0700 Subject: [PATCH] runtime: convert windows netpollWakeSig to atomic type Updates #53821 Change-Id: Ifc5bc551a4bcf82bf10d2e670ad2644eb9c6b334 Reviewed-on: https://go-review.googlesource.com/c/go/+/423879 TryBot-Result: Gopher Robot Run-TryBot: Cuong Manh Le Reviewed-by: Michael Pratt Reviewed-by: Keith Randall Auto-Submit: Cuong Manh Le --- src/runtime/netpoll_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/netpoll_windows.go b/src/runtime/netpoll_windows.go index 7e4664909cc..796bf1dd195 100644 --- a/src/runtime/netpoll_windows.go +++ b/src/runtime/netpoll_windows.go @@ -35,7 +35,7 @@ type overlappedEntry struct { var ( iocphandle uintptr = _INVALID_HANDLE_VALUE // completion port io handle - netpollWakeSig uint32 // used to avoid duplicate calls of netpollBreak + netpollWakeSig atomic.Uint32 // used to avoid duplicate calls of netpollBreak ) func netpollinit() { @@ -68,7 +68,7 @@ func netpollarm(pd *pollDesc, mode int) { 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 } @@ -136,7 +136,7 @@ func netpoll(delay int64) gList { } handlecompletion(&toRun, op, errno, qty) } else { - atomic.Store(&netpollWakeSig, 0) + netpollWakeSig.Store(0) if delay == 0 { // Forward the notification to the // blocked poller.