Version: v0.2.4 Latest Latest

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 5 Imported by: 0




This section is empty.


View Source
var ErrClosed = errors.New("poller instance is not running")

ErrClosed 重复 close poller 错误


This section is empty.


type Event

type Event uint32

Event poller 返回事件

const (
	EventRead  Event = 0x1
	EventWrite Event = 0x2
	EventErr   Event = 0x80
	EventNone  Event = 0

Event poller 返回事件值

type Poller

type Poller struct {
	// contains filtered or unexported fields

Poller Epoll封装

func Create

func Create() (*Poller, error)

Create 创建Poller

func (*Poller) AddRead

func (ep *Poller) AddRead(fd int) error

AddRead 注册fd到epoll,并注册可读事件

func (*Poller) AddWrite

func (ep *Poller) AddWrite(fd int) error

AddWrite 注册fd到epoll,并注册可写事件

func (*Poller) Close

func (ep *Poller) Close() (err error)

Close 关闭 epoll

func (*Poller) Del

func (ep *Poller) Del(fd int) error

Del 从epoll中删除fd

func (*Poller) EnableRead

func (ep *Poller) EnableRead(fd int) error

EnableRead 修改fd注册事件为可读事件

func (*Poller) EnableReadWrite

func (ep *Poller) EnableReadWrite(fd int) error

EnableReadWrite 修改fd注册事件为可读可写事件

func (*Poller) EnableWrite

func (ep *Poller) EnableWrite(fd int) error

EnableWrite 修改fd注册事件为可写事件

func (*Poller) Poll

func (ep *Poller) Poll(handler func(fd int, event Event))

Poll 启动 epoll wait 循环

func (*Poller) Wake

func (ep *Poller) Wake() error

Wake 唤醒 epoll

Source Files

Jump to

Keyboard shortcuts

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