timer

package
v1.1.44 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron

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

func (*Cron) Stop

func (c *Cron) Stop()

type CronExpr

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

CronExpr Field name | Mandatory? | Allowed values | Allowed special characters ---------- | ---------- | -------------- | -------------------------- Seconds | No | 0-59 | * / , - Minutes | Yes | 0-59 | * / , - Hours | Yes | 0-23 | * / , - Day of month | Yes | 1-31 | * / , - Month | Yes | 1-12 | * / , - Day of week | Yes | 0-6 | * / , -

func NewCronExpr

func NewCronExpr(expr string) (cronExpr *CronExpr, err error)

NewCronExpr goroutine safe

func (*CronExpr) Next

func (e *CronExpr) Next(t time.Time) time.Time

Next goroutine safe

type Dispatcher

type Dispatcher struct {
	ChanTimer chan *Timer
}

Dispatcher one dispatcher per goroutine (goroutine not safe)

func NewDispatcher

func NewDispatcher(l int) *Dispatcher

func (*Dispatcher) AfterFunc

func (d2 *Dispatcher) AfterFunc(d time.Duration, cb func()) *Timer

func (*Dispatcher) CronFunc

func (d2 *Dispatcher) CronFunc(cronExpr *CronExpr, _cb func()) *Cron

func (*Dispatcher) LoopFunc added in v1.1.9

func (d2 *Dispatcher) LoopFunc(d time.Duration, _cb func()) *Cron

LoopFunc 由于循环队列只支持cron表达式,而cron表达式最少只有到秒级别,游戏中同步一般都是毫秒级别,所以在此添加毫秒级别的循环队列

type Timer

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

func (*Timer) Cb

func (t *Timer) Cb()

func (*Timer) Stop

func (t *Timer) Stop()

Jump to

Keyboard shortcuts

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