netpoll

package module
v0.0.0-...-9739b0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 4 Imported by: 1

README

netpoll

net polling

Documentation

Index

Constants

View Source
const (
	EOF
	Read
	Write
	Closed

	Oneshot
)

Variables

View Source
var (
	ErrNoOperation = errors.New("no operation selected")
	ErrUnsupported = errors.New("unsupported")
	ErrNoEvents    = errors.New("no events")
)

Functions

func Fd

func Fd(f interface{}) (fd int, err error)

func Select

func Select(rs []io.Reader, to time.Duration) (io.Reader, error)

Types

type Event

type Event struct {
	Fd    int
	Event int
	Arg1  int64
}

type Poll

type Poll struct {
	// contains filtered or unexported fields
}

func NewPoll

func NewPoll() (p *Poll, err error)

func (*Poll) Add

func (p *Poll) Add(fd, flags int) (err error)

func (*Poll) Close

func (p *Poll) Close() (err error)

func (*Poll) Del

func (p *Poll) Del(fd int) (err error)

func (*Poll) Wait

func (p *Poll) Wait(evs []Event, to time.Duration) (n int, err error)

Wait waits for events storing them to evs buffer. returned n is a number of events read the same as io.Reader works. to is timeout to wait.

If to is -1 it blocks until some event happen or interrupted. If to is 0 it returns immidietly even if no events occured. Otherwise it's a maximum time to wait.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL