timed

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTask

func AddTask(task *Task) error

AddTask adds a task to the timer.

func Go

func Go(f func())

Go run a function in `ants` goroutine pool, if submit failed, fallback to use goroutine.

func Start

func Start()

Start the timer.

func Started

func Started() bool

Started have started or not.

func Stop

func Stop()

Stop the timer.

func TaskCounter

func TaskCounter() int64

TaskCounter task total number of tasks.

func TickMs

func TickMs() int64

TickMs Basic time tick milliseconds.

func WheelSize

func WheelSize() int

WheelSize wheel size.

Types

type Task

type Task = timer.Task

Task alias timer.Task

func AfterFunc

func AfterFunc(d time.Duration, f func()) (*Task, error)

AfterFunc adds a function to the timer.

func NewTask

func NewTask(d time.Duration) *Task

NewTask new task with delay duration and empty job, the accuracy is milliseconds.

func NewTaskFunc

func NewTaskFunc(d time.Duration, f func()) *Task

NewTaskFunc new task with delay duration and function job, the accuracy is milliseconds.

Jump to

Keyboard shortcuts

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