poll: maze.io/x/poll Index | Files

package poll

import "maze.io/x/poll"

Index

Package Files

descriptor.go epoll_linux.go poll.go poll_linux.go

Constants

const (
    EPOLLIN      = unix.EPOLLIN
    EPOLLOUT     = unix.EPOLLOUT
    EPOLLRDHUP   = unix.EPOLLRDHUP
    EPOLLPRI     = unix.EPOLLPRI
    EPOLLERR     = unix.EPOLLERR
    EPOLLHUP     = unix.EPOLLHUP
    EPOLLET      = unix.EPOLLET
    EPOLLONESHOT = unix.EPOLLONESHOT
    EPOLLCLOSED  = 0X20
)

Variables

var (
    ErrClosed        = errors.New("poll: closed")
    ErrRegistered    = errors.New("poll: file descriptor already registered")
    ErrNotRegistered = errors.New("poll: file descriptor not registered")
    ErrNotFiler      = errors.New("poll: could not get file descriptor")
)

type Config Uses

type Config struct {
    OnWaitError func(error)
}

Config contains the base poller configuration

type Descriptor Uses

type Descriptor struct {
    *os.File
    Event
}

func Handle Uses

func Handle(c net.Conn, events Event) (*Descriptor, error)

func HandleRead Uses

func HandleRead(c net.Conn) (*Descriptor, error)

func HandleReadOnce Uses

func HandleReadOnce(c net.Conn) (*Descriptor, error)

func HandleReadWrite Uses

func HandleReadWrite(c net.Conn) (*Descriptor, error)

func HandleWrite Uses

func HandleWrite(c net.Conn) (*Descriptor, error)

func HandleWriteOnce Uses

func HandleWriteOnce(c net.Conn) (*Descriptor, error)

func NewDescriptor Uses

func NewDescriptor(fd uintptr, ev Event) *Descriptor

type Event Uses

type Event uint16

Event mask

const (
    EventRead Event = 1 << iota
    EventWrite
    EventOneShot
    EventEdgeTriggered
    EventHUP
    EventReadHUP
    EventWriteHUP
    EventError
    EventClosed Event = 0x8000
)

Event types

func (Event) String Uses

func (event Event) String() string

type Poller Uses

type Poller interface {
    Start(*Descriptor, func(Event)) error
    Stop(*Descriptor) error
    Resume(*Descriptor) error
}

Poller describes a poll capable interface

func New Uses

func New(c *Config) (Poller, error)

Package poll imports 8 packages (graph). Updated 2019-08-19. Refresh now. Tools for package owners.