timed

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 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 return the total number of tasks.

func TickMs

func TickMs() int64

TickMs return Basic time tick milliseconds.

func WheelSize

func WheelSize() int

WheelSize return the wheel size.

Types

type Job added in v0.5.3

type Job = timer.Job

alias

type JobFunc added in v0.5.3

type JobFunc = timer.JobFunc

alias

type Task

type Task = timer.Task

alias

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 an empty job, the accuracy is milliseconds.

func NewTaskFunc

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

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

func NewTaskJob added in v0.5.3

func NewTaskJob(d time.Duration, j Job) *Task

NewTaskJob new task with delay duration and a job, the accuracy is milliseconds.

Jump to

Keyboard shortcuts

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