fstime

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interval

type Interval struct {

	// Concurrency 回调任务并发度,当为 0 时,为全并发
	Concurrency int
	// contains filtered or unexported fields
}

Interval 定时器

func (*Interval) Add

func (it *Interval) Add(fn func())

Add 注册回调函数

 应确保函数不会 panic。若 fn panic,会自动 recover 同时将 panic 信息丢弃。
	默认情况下,若 fn 运行时间 > 调度时间间隔,同一个 fn 在同一时间会有多个运行实例

func (*Interval) Done

func (it *Interval) Done() <-chan struct{}

Done 运行状态

func (*Interval) Reset

func (it *Interval) Reset(d time.Duration)

Reset 重置时间,应该先使用 Start 启动任务

func (*Interval) Running

func (it *Interval) Running() bool

Running 返回定时器的运行状态

func (*Interval) Start

func (it *Interval) Start(d time.Duration)

Start 启动任务,每间隔固定时长 d,就会触发一次任务

func (*Interval) Stop

func (it *Interval) Stop()

Stop 停止运行

Jump to

Keyboard shortcuts

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