eventloop

package
v0.0.0-...-c429a28 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT 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 {
	Context interface{}
	// contains filtered or unexported fields
}

func NewEventLoop

func NewEventLoop() *EventLoop

func (*EventLoop) Close

func (this *EventLoop) Close()

func (*EventLoop) Func

func (loop *EventLoop) Func(functor func()) func()

func (*EventLoop) Loop

func (this *EventLoop) Loop()

func (*EventLoop) RunAfter

func (this *EventLoop) RunAfter(d time.Duration, f func()) *Timer

func (*EventLoop) RunEvery

func (this *EventLoop) RunEvery(d time.Duration, f func()) *Ticker

func (*EventLoop) RunInLoop

func (this *EventLoop) RunInLoop(functor func())

type LoopHandler

type LoopHandler interface {
	LoopInit(loop *EventLoop)
	LoopClose(loop *EventLoop)
}

type Pool

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

func NewPool

func NewPool(numWorkers int, handler LoopHandler) *Pool

func (*Pool) Close

func (this *Pool) Close()

func (*Pool) GetAllLoops

func (this *Pool) GetAllLoops() []*EventLoop

func (*Pool) GetLoopForHash

func (this *Pool) GetLoopForHash(hashCode int) *EventLoop

func (*Pool) GetNextLoop

func (this *Pool) GetNextLoop() *EventLoop

type Ticker

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

func (*Ticker) Stop

func (this *Ticker) Stop()

type Timer

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

func (*Timer) Reset

func (this *Timer) Reset(d time.Duration) bool

func (*Timer) Stop

func (this *Timer) Stop() bool

type Worker

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

func NewWorker

func NewWorker(handler LoopHandler) *Worker

func (*Worker) Close

func (this *Worker) Close()

func (*Worker) GetLoop

func (this *Worker) GetLoop() *EventLoop

Jump to

Keyboard shortcuts

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