eventloop

package
v0.0.0-...-bd135c8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventLoop

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

EventLoop:事件循环

func New

func New() (*EventLoop, error)

New:创建一个 EventLoop

func (*EventLoop) AddSocketAndEnableRead

func (l *EventLoop) AddSocketAndEnableRead(fd int, s Socket) error

AddSocketAndEnableRead:增加 Socket 到事件循环中,并注册可读事件

func (*EventLoop) DeleteFdInLoop

func (l *EventLoop) DeleteFdInLoop(fd int)

DeleteFdInLoop:删除 fd

func (*EventLoop) EnableRead

func (l *EventLoop) EnableRead(fd int) error

EnableRead:使能可写事件

func (*EventLoop) EnableReadWrite

func (l *EventLoop) EnableReadWrite(fd int) error

EnableReadWrite:使能可读可写事件

func (*EventLoop) PacketBuf

func (l *EventLoop) PacketBuf() []byte

PacketBuf:内部使用,临时缓冲区

func (*EventLoop) QueueInLoop

func (l *EventLoop) QueueInLoop(f func())

QueueInLoop:添加 func 到事件循环中执行

func (*EventLoop) RunLoop

func (l *EventLoop) RunLoop()

RunLoop:启动事件循环

func (*EventLoop) Stop

func (l *EventLoop) Stop() error

Stop:关闭事件循环

type Socket

type Socket interface {
	HandleEvent(fd int, events poller.Event)
	Close() error
}

Socket:socket 接口

Jump to

Keyboard shortcuts

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