internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetKeepAlive

func SetKeepAlive(fd, secs int) error

SetKeepAlive 设置 fd KeepAlive

func SockaddrToAddr

func SockaddrToAddr(sa syscall.Sockaddr) net.Addr

SockaddrToAddr returns a go/net friendly address

Types

type Poll

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

Poll 结构包含了 epoll 和 eventfd 文件描述符

func OpenPoll

func OpenPoll() *Poll

OpenPoll 初始化并返回一个新的 Poll 结构

func (*Poll) AddRead

func (p *Poll) AddRead(fd int)

AddRead 添加文件描述符为边缘触发的读事件

func (*Poll) AddReadWrite

func (p *Poll) AddReadWrite(fd int)

AddReadWrite 添加文件描述符为边缘触发的读写事件

func (*Poll) Close

func (p *Poll) Close() error

Close 关闭 Poll 结构中的文件描述符

func (*Poll) ModDetach

func (p *Poll) ModDetach(fd int)

ModDetach 从 epoll 中移除文件描述符

func (*Poll) ModRead

func (p *Poll) ModRead(fd int)

ModRead 修改文件描述符为边缘触发的读事件

func (*Poll) ModReadWrite

func (p *Poll) ModReadWrite(fd int)

ModReadWrite 修改文件描述符为边缘触发的读写事件

func (*Poll) Trigger

func (p *Poll) Trigger(note interface{}) error

Trigger 添加一个通知到 notes 队列并唤醒 epoll

func (*Poll) Wait

func (p *Poll) Wait(iter func(fd int, note interface{}) error) error

Wait 监听 epoll 事件,并在事件发生时调用迭代器

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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