timer

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package timer 系统时间

Package timer 定时器实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTimeMs

func GetTimeMs() uint64

GetTimeMs 获取系统毫秒时间

Types

type FTimerCallback

type FTimerCallback func(time.Duration) bool

FTimerCallback 返回是否还将定时

type Manager

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

Manager 定时器管理器

func (*Manager) KillRegister

func (tr *Manager) KillRegister()

KillRegister 关闭所有当前管理器中的定时器

func (*Manager) RegTimer

func (tr *Manager) RegTimer(duration time.Duration, limitTimes int64, engross bool, cb func(time.Duration) bool) *Timer

RegTimer limitTimes 限制了这个定时任务重复执行的次数,如果为 0 ,那么将不限制 其执行的次数。 如果 engross 为 true,那么这个 timer 的执行将独占一个协程 如果一个定时操作很耗时,你应该将它作为一个单独的协程去处理,但是这样你可能 要考虑并行执行带来的问题

type Timer

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

Timer 定时器

func (*Timer) IsStop

func (tr *Timer) IsStop() bool

IsStop 判断定时器是否已经停止

func (*Timer) KillTimer

func (tr *Timer) KillTimer()

KillTimer 关闭定时器

func (*Timer) Select

func (tr *Timer) Select(exChan chan *Timer)

Select 开始监听定时器

Jump to

Keyboard shortcuts

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