timer

package
v0.0.0-...-26c2032 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 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 cellnetEx.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 cellnetEx.EventQueue
	// contains filtered or unexported fields
}

轻量级的持续Tick循环

func NewLoop

func NewLoop(q cellnetEx.EventQueue, duration time.Duration, notifyCallback 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) NotifyFunc

func (self *Loop) NotifyFunc() func(*Loop)

func (*Loop) Resume

func (self *Loop) Resume()

func (*Loop) Running

func (self *Loop) Running() bool

func (*Loop) SetNotifyFunc

func (self *Loop) SetNotifyFunc(notifyCallback func(*Loop)) *Loop

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