timer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimerHandleGenerator uint32      = 1
	InvalidTimerHandle   TimerHandle = 0
	TimerModule          *TimerMgr   = NewTimerMgr()
)
View Source
var Config = Configuration{}

Functions

func SendTimeout

func SendTimeout(te *TimerEntity) bool

func StopTimer

func StopTimer(h TimerHandle) bool

Types

type Configuration

type Configuration struct {
	Options basic.Options
}

func (*Configuration) Close

func (c *Configuration) Close() error

func (*Configuration) Init

func (c *Configuration) Init() error

func (*Configuration) Name

func (c *Configuration) Name() string

type TimerAction

type TimerAction interface {
	OnTimer(h TimerHandle, ud interface{}) bool
}

type TimerActionCommon

type TimerActionCommon struct {
	Taw TimerActionWrapper
}

func (TimerActionCommon) OnTimer

func (this TimerActionCommon) OnTimer(h TimerHandle, ud interface{}) bool

type TimerActionWrapper

type TimerActionWrapper func(h TimerHandle, ud interface{}) bool

func (TimerActionWrapper) OnTimer

func (taw TimerActionWrapper) OnTimer(h TimerHandle, ud interface{}) bool

type TimerEntity

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

type TimerHandle

type TimerHandle uint32

func AfterTimer

func AfterTimer(taw TimerActionWrapper, ud interface{}, interval time.Duration) (TimerHandle, bool)

func StartTimer

func StartTimer(ta TimerAction, ud interface{}, interval time.Duration, times int) (TimerHandle, bool)

StartTimer only can be called in main module

func StartTimerByObject

func StartTimerByObject(src *basic.Object, ta TimerAction, ud interface{}, interval time.Duration, times int) (TimerHandle, bool)

type TimerMgr

type TimerMgr struct {
	*basic.Object
	// contains filtered or unexported fields
}

func NewTimerMgr

func NewTimerMgr() *TimerMgr

func (*TimerMgr) OnStart

func (tm *TimerMgr) OnStart()

func (*TimerMgr) OnStop

func (tm *TimerMgr) OnStop()

func (*TimerMgr) OnTick

func (tm *TimerMgr) OnTick()

func (*TimerMgr) Start

func (tm *TimerMgr) Start()

func (*TimerMgr) TimerCount

func (tm *TimerMgr) TimerCount() int

type TimerQueue

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

func NewTimerQueue

func NewTimerQueue() *TimerQueue

func (TimerQueue) Len

func (tq TimerQueue) Len() int

func (TimerQueue) Less

func (tq TimerQueue) Less(i, j int) bool

func (*TimerQueue) Pop

func (tq *TimerQueue) Pop() interface{}

func (*TimerQueue) Push

func (tq *TimerQueue) Push(x interface{})

func (*TimerQueue) Swap

func (tq *TimerQueue) Swap(i, j int)

Jump to

Keyboard shortcuts

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