mirror of
https://github.com/golang/go
synced 2024-11-18 09:44:50 -07:00
runtime: record stub netpoll initialization, add lock around note
This fixes the Plan 9 support for the new timer code. Updates #6239 Updates #27707 Change-Id: Ia498c399b8924910b97fcde07545fae3588aad47 Reviewed-on: https://go-review.googlesource.com/c/go/+/204045 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
47efbf0a4e
commit
9e094ea01e
@ -16,6 +16,7 @@ var netpollNote note
|
||||
var netpollBroken uint32
|
||||
|
||||
func netpollGenericInit() {
|
||||
atomic.Store(&netpollInited, 1)
|
||||
}
|
||||
|
||||
func netpollBreak() {
|
||||
@ -30,13 +31,17 @@ func netpoll(delay int64) gList {
|
||||
// Implementation for platforms that do not support
|
||||
// integrated network poller.
|
||||
if delay != 0 {
|
||||
// This lock ensures that only one goroutine tries to use
|
||||
// the note. It should normally be completely uncontended.
|
||||
lock(&netpollStubLock)
|
||||
noteclear(&netpollNote)
|
||||
atomic.Store(&netpollBroken, 0)
|
||||
notetsleep(&netpollNote, delay)
|
||||
unlock(&netpollStubLock)
|
||||
}
|
||||
return gList{}
|
||||
}
|
||||
|
||||
func netpollinited() bool {
|
||||
return false
|
||||
return atomic.Load(&netpollInited) != 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user