timer

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterStopper

type AfterStopper interface {
	Stop() bool
}

func After

func After(q cellnet.EventQueue, duration time.Duration, callbackObj interface{}, context interface{}) AfterStopper

在给定的duration持续时间后, 执行callbackObj对象类型对应的函数回调 q: 队列,在指定的队列goroutine执行, 空时,直接在当前goroutine context: 将context上下文传递到带有context指针的函数回调中

type Loop

type Loop struct {
	Context  interface{}
	Duration time.Duration

	Queue cellnet.EventQueue
	// contains filtered or unexported fields
}

轻量级的持续Tick循环

func NewLoop

func NewLoop(q cellnet.EventQueue, duration time.Duration, callback func(*Loop), context interface{}) *Loop

执行一个循环, 持续调用callback, 周期是duration context: 将context上下文传递到带有context指针的函数回调中

func (*Loop) NextLoop

func (self *Loop) NextLoop()

func (*Loop) Notify

func (self *Loop) Notify() *Loop

马上调用一次用户回调

func (*Loop) Running

func (self *Loop) Running() bool

func (*Loop) Start

func (self *Loop) Start() bool

开始Tick

func (*Loop) Stop

func (self *Loop) Stop()

Jump to

Keyboard shortcuts

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