timer

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loop

func Loop(timer unsafe.Pointer, state interface{}, now2 int64)

func NewTimerPointer

func NewTimerPointer() unsafe.Pointer

func Start

func Start(timer unsafe.Pointer, key TimerKey, inv, times int32, f interface{}, args ...interface{})

Types

type Timer

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

func NewTimer

func NewTimer() *Timer

func (*Timer) Add

func (t *Timer) Add(key TimerKey, inv, times int32, f interface{}, args ...interface{})

inv <= 0 表示永久定时器

func (*Timer) Del

func (t *Timer) Del(key TimerKey)

func (*Timer) Loop

func (t *Timer) Loop(state interface{}, now2 int64)

TODO 后续考虑增加多级时间分类,减少遍历长度

type TimerKey

type TimerKey struct {
	Key int32
	ID  int32
}

Jump to

Keyboard shortcuts

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