ae

package
v0.0.0-...-79084ad Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUnixTime

func GetUnixTime() int64

GetUnixTime 单位为ms

Types

type EventLoop

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

func CreateEventLoop

func CreateEventLoop() (loop *EventLoop, err error)

func (*EventLoop) AddEvent

func (loop *EventLoop) AddEvent(fd int, eventType FileEventType, fn FileProcFn, extra interface{}) (err error)

func (*EventLoop) AddTimeEvent

func (loop *EventLoop) AddTimeEvent(interval int64, eventType TimeEventType, fn TimeProcFn, extra interface{})

func (*EventLoop) AeMain

func (loop *EventLoop) AeMain() error

func (*EventLoop) DelEvent

func (loop *EventLoop) DelEvent(fd int, eventType FileEventType) (err error)

func (*EventLoop) DelTimeEvent

func (loop *EventLoop) DelTimeEvent(id int)

func (*EventLoop) Range

func (loop *EventLoop) Range() (n int)

测试使用

func (*EventLoop) Wait

func (loop *EventLoop) Wait() ([]*FileEvent, []*TimeEvent, error)

type FileEvent

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

FileEvent 文件事件

type FileEventType

type FileEventType int
const (
	FileEventType_Readable  FileEventType = 1 // 可读
	FileEventType_Writeable FileEventType = 2 // 可写
)

type FileProcFn

type FileProcFn func(extra interface{}) // 文件处理回调

type TimeEvent

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

TimeEvent 时间事件

type TimeEventType

type TimeEventType int
const (
	TimeEventType_Cycle TimeEventType = 1 // 循环
	TimeEventType_Once  TimeEventType = 2 // 一次性
)

type TimeProcFn

type TimeProcFn func(extra interface{}) // 时间处理回调

Jump to

Keyboard shortcuts

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