poll

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Poller provides an encapsulation of methods provided by package sys which is a generalization of syscalls from different platforms.

Index

Constants

This section is empty.

Variables

View Source
var PollTaskPool = sync.Pool{
	New: func() interface{} {
		return &PollTask{}
	},
}

Functions

func PutTask

func PutTask(t *PollTask)

Types

type PollTask

type PollTask struct {
	Go  iface.PollTaskFunc
	Arg iface.PollTaskArg
}

func GetTask

func GetTask() *PollTask

type Poller

type Poller struct {
	Eloop      iface.IELoop // eventloop
	Pool       *ants.Pool   // goroutine pool for running tasks
	ErrForStop chan error   // channel for sending error info to stop the whole engine

	ReadBufferSize int // size of read buffer when reading from fd
	// contains filtered or unexported fields
}

func New

func New() (p *Poller, err error)

func (*Poller) AddPriorTask

func (that *Poller) AddPriorTask(f iface.PollTaskFunc, arg iface.PollTaskArg) (err error)

func (*Poller) AddRead

func (that *Poller) AddRead(fd iface.IFd) error

func (*Poller) AddReadWrite

func (that *Poller) AddReadWrite(fd iface.IFd) error

func (*Poller) AddTask

func (that *Poller) AddTask(f iface.PollTaskFunc, arg iface.PollTaskArg) (err error)

func (*Poller) AddWrite

func (that *Poller) AddWrite(fd iface.IFd) error

func (*Poller) Close

func (that *Poller) Close() error

func (*Poller) GetFd

func (that *Poller) GetFd() int

func (*Poller) GetPollEvFd

func (that *Poller) GetPollEvFd() int

func (*Poller) ModRead

func (that *Poller) ModRead(fd iface.IFd) error

func (*Poller) ModReadWrite

func (that *Poller) ModReadWrite(fd iface.IFd) error

func (*Poller) ModWrite

func (that *Poller) ModWrite(fd iface.IFd) error

func (*Poller) RemoveFd

func (that *Poller) RemoveFd(fd iface.IFd) error

func (*Poller) Start

func (that *Poller) Start(callback iface.IPollCallback) error

Jump to

Keyboard shortcuts

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