cloud-org / go-timewheel

fork from rfyiamcool/go-timewheel and modify by ashing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-timewheel

自用魔改时间轮。

usage

package main_test

func TestTimeWheelAdd(t *testing.T) {
	tw, err := NewTimeWheel(1*time.Second, 3)
	if err != nil {
		fmt.Println(err)
	}
	tw.Start()
	defer tw.Stop()
	var wg sync.WaitGroup
	wg.Add(1)
	tw.Add(0*time.Second, func() {
		defer wg.Done()
		log.Println("hello world")
	})
	wg.Wait()
}

About

fork from rfyiamcool/go-timewheel and modify by ashing


Languages

Language:Go 100.0%