timers

package
v0.0.0-...-7647e70 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 2 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(atTime time.Time, task func(timer *time.Timer)) *time.Timer

在某个时间点执行函数,不阻塞当前进程

func Delay

func Delay(duration time.Duration, task func(timer *time.Timer)) *time.Timer

延时执行函数,不阻塞当前进程

func Every

func Every(duration time.Duration, task func(ticker *time.Ticker)) *time.Ticker

每隔一段时间执行函数,不阻塞当前进程

Types

type Looper

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

func Loop

func Loop(duration time.Duration, task func(looper *Looper)) *Looper

循环执行某个函数,并保持每次执行之间的间隔

func NewLooper

func NewLooper() *Looper

func (*Looper) Stop

func (this *Looper) Stop()

func (*Looper) Wait

func (this *Looper) Wait()

Jump to

Keyboard shortcuts

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