mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
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 <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
ec8ed5bd02
commit
9b988c9094
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue