timer

package
v0.0.0-...-935d597 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CIRCLE_MODE     = true
	NOT_CIRCLE_MODE = false
	SYNC_MODE       = true
)

Variables

This section is empty.

Functions

func TickSafeMode

func TickSafeMode() optionCall

Types

type Task

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

type TaskID

type TaskID int64

type TimeWheel

type TimeWheel struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTimeWheel

func NewTimeWheel(tick time.Duration, bucketNum int, options ...optionCall) (*TimeWheel, error)

func (*TimeWheel) AddTask

func (tw *TimeWheel) AddTask(taskName string, delay time.Duration, callback func(), cronTask bool) error

AddTask

func (*TimeWheel) GenUniqueId

func (tw *TimeWheel) GenUniqueId() TaskID

func (*TimeWheel) RemoveTask

func (tw *TimeWheel) RemoveTask(taskName string) error

RemoveTask

func (*TimeWheel) Start

func (tw *TimeWheel) Start()

func (*TimeWheel) Stop

func (tw *TimeWheel) Stop()

Jump to

Keyboard shortcuts

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