package poll
import (
_
)
func () int64
func ()
func ( uintptr) (uintptr, int)
func ( uintptr)
func ( uintptr, int) int
func ( uintptr, int) int
func ( uintptr, int) int
func ( uintptr, int64, int)
func ( uintptr)
func ( uintptr) bool
type pollDesc struct {
runtimeCtx uintptr
}
var serverInit sync.Once
func ( *pollDesc) ( *FD) error {
serverInit.Do(runtime_pollServerInit)
, := runtime_pollOpen(uintptr(.Sysfd))
if != 0 {
return errnoErr(syscall.Errno())
}
.runtimeCtx =
return nil
}
func ( *pollDesc) () {
if .runtimeCtx == 0 {
return
}
runtime_pollClose(.runtimeCtx)
.runtimeCtx = 0
}
func ( *pollDesc) () {
if .runtimeCtx == 0 {
return
}
runtime_pollUnblock(.runtimeCtx)
}
func ( *pollDesc) ( int, bool) error {
if .runtimeCtx == 0 {
return nil
}
:= runtime_pollReset(.runtimeCtx, )
return convertErr(, )
}
func ( *pollDesc) ( bool) error {
return .prepare('r', )
}
func ( *pollDesc) ( bool) error {
return .prepare('w', )
}
func ( *pollDesc) ( int, bool) error {
if .runtimeCtx == 0 {
return errors.New("waiting for unsupported file type")
}
:= runtime_pollWait(.runtimeCtx, )
return convertErr(, )
}
func ( *pollDesc) ( bool) error {
return .wait('r', )
}
func ( *pollDesc) ( bool) error {
return .wait('w', )
}
func ( *pollDesc) ( int) {
if .runtimeCtx == 0 {
return
}
runtime_pollWaitCanceled(.runtimeCtx, )
}
func ( *pollDesc) () bool {
return .runtimeCtx != 0
}
const (
pollNoError = 0
pollErrClosing = 1
pollErrTimeout = 2
pollErrNotPollable = 3
)
func ( int, bool) error {
switch {
case pollNoError:
return nil
case pollErrClosing:
return errClosing()
case pollErrTimeout:
return ErrDeadlineExceeded
case pollErrNotPollable:
return ErrNotPollable
}
println("unreachable: ", )
panic("unreachable")
}
func ( *FD) ( time.Time) error {
return setDeadlineImpl(, , 'r'+'w')
}
func ( *FD) ( time.Time) error {
return setDeadlineImpl(, , 'r')
}
func ( *FD) ( time.Time) error {
return setDeadlineImpl(, , 'w')
}
func ( *FD, time.Time, int) error {
var int64
if !.IsZero() {
= int64(time.Until())
if == 0 {
= -1
}
}
if := .incref(); != nil {
return
}
defer .decref()
if .pd.runtimeCtx == 0 {
return ErrNoDeadline
}
runtime_pollSetDeadline(.pd.runtimeCtx, , )
return nil
}
func ( uintptr) bool {
return runtime_isPollServerDescriptor()
}