timingwheel

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 7 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayQueue

type DelayQueue struct {
	C chan interface{}
	// contains filtered or unexported fields
}

func NewDelayQueue

func NewDelayQueue(size int) *DelayQueue

func (*DelayQueue) Poll

func (dq *DelayQueue) Poll(exitC chan struct{}, nowF func() int64)

func (*DelayQueue) Push

func (dq *DelayQueue) Push(elem interface{}, expiration int64)

type Scheduler

type Scheduler interface {
	Next(time.Time) time.Time
}

type Timer

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

计时器

func (*Timer) Stop

func (t *Timer) Stop() bool

stop

type TimingWheel

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

func NewTimingWheel

func NewTimingWheel(tick time.Duration, wheelSize int64) *TimingWheel

精度:tick | wheelSize:槽数

func (*TimingWheel) AfterFunc

func (tw *TimingWheel) AfterFunc(d time.Duration, f func()) *Timer

通过这个函数来指定定时时间和执行函数

func (*TimingWheel) ScheduleFunc

func (tw *TimingWheel) ScheduleFunc(s Scheduler, f func()) (t *Timer)

func (*TimingWheel) Start

func (tw *TimingWheel) Start()

func (*TimingWheel) Stop

func (tw *TimingWheel) Stop()

Jump to

Keyboard shortcuts

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