Source File
netpoll_kqueue.go
Belonging Package
runtime
package runtime
import (
)
var (
kq int32 = -1
netpollBreakRd, netpollBreakWr uintptr // for netpollBreak
netpollWakeSig uint32 // used to avoid duplicate calls of netpollBreak
)
func () {
kq = kqueue()
if kq < 0 {
println("runtime: kqueue failed with", -kq)
throw("runtime: netpollinit failed")
}
closeonexec(kq)
, , := nonblockingPipe()
if != 0 {
println("runtime: pipe failed with", -)
throw("runtime: pipe failed")
}
:= keventt{
filter: _EVFILT_READ,
flags: _EV_ADD,
}
*(*uintptr)(unsafe.Pointer(&.ident)) = uintptr()
:= kevent(kq, &, 1, nil, 0, nil)
if < 0 {
println("runtime: kevent failed with", -)
throw("runtime: kevent failed")
}
netpollBreakRd = uintptr()
netpollBreakWr = uintptr()
}
func ( uintptr) bool {
return == uintptr(kq) || == netpollBreakRd || == netpollBreakWr
}
var [16]byte
read(int32(netpollBreakRd), noescape(unsafe.Pointer(&[0])), int32(len()))
atomic.Store(&netpollWakeSig, 0)
}
continue
}
var int32
switch .filter {
case _EVFILT_READ:
+= 'r'
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |