timer

package
v0.0.0-...-2f8f7b3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HIGH_FRAME_INTERVAL = 30
	HIGH_FRAME_LIMIT    = 100
	LOW_FRAME_INTERVAL  = 100
	LOW_FRAME_LIMIT     = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FixWorker

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

func NewFixWorker

func NewFixWorker(workerID uint64, interval int64, workerFunc WorkerFunc, count int) *FixWorker

type HighFrameWorker

type HighFrameWorker struct {
	*Worker
}

func NewHighFrameWorker

func NewHighFrameWorker(interval int64, workerFunc WorkerFunc) *HighFrameWorker

type ILoopWorker

type ILoopWorker interface {
	RegHighWorker(worker *HighFrameWorker)
	RegLowWorker(worker *LowFrameWorker)
	RegFixWorker(worker *FixWorker)
	Stop()
}

type IWorker

type IWorker interface {
	Handle(nowTime int64)
}

type LowFrameWorker

type LowFrameWorker struct {
	*Worker
}

func NewLowFrameWorker

func NewLowFrameWorker(interval int64, workerFunc WorkerFunc) *LowFrameWorker

type TimerLoop

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

func NewTimerLoop

func NewTimerLoop(highInterval, lowInterval int64) *TimerLoop

func (*TimerLoop) RegFixWorker

func (t *TimerLoop) RegFixWorker(worker *FixWorker)

func (*TimerLoop) RegHighWorker

func (t *TimerLoop) RegHighWorker(worker *HighFrameWorker)

func (*TimerLoop) RegLowWorker

func (t *TimerLoop) RegLowWorker(worker *LowFrameWorker)

func (*TimerLoop) Stop

func (t *TimerLoop) Stop()

func (*TimerLoop) TimeLoop

func (t *TimerLoop) TimeLoop(nowTime int64)

call this function after init all resoure over

type Worker

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

func NewWoker

func NewWoker(interval int64, workerFunc WorkerFunc) *Worker

func (*Worker) Handle

func (w *Worker) Handle(nowTime int64)

type WorkerFunc

type WorkerFunc func(nowTime int64)

Jump to

Keyboard shortcuts

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