Skip to content

vlorc/timer

Repository files navigation

timing wheel

License codebeat badge Go Report Card GoDoc Build Status Coverage Status

golang timing wheel timer

Examples

base timer

import (
	"fmt"
	"github.com/vlorc/timer"
)

func main() {
	timing := NewTimingWheel(
    		NewSimpleScheduler(NewSimpleDispatcher()),
    		64,
    		time.Second,
    		64,128,256,512)
    timing.Start()
    timing.After(26 * time.Second, func() {
    	fmt.Println("26 Second")
    	timing.Stop()
    })
    timing.Wait()
}