RussellLuo / timingwheel

Golang implementation of Hierarchical Timing Wheels.
MIT License
660 stars 125 forks source link

允许替换任务执行方式 #46

Open yeaha opened 1 year ago

yeaha commented 1 year ago

提供SetTaskRunner()方法,允许自行实现任务具体的执行方式

例如可以使用goroutine pool进一步提高并发执行效率

import (
  "github.com/panjf2000/ants"
  "github.com/RussellLuo/timingwheel"
)

func init() {
  timingwheel.SetTaskRunner(func(task func()) {
    ants.Submit(task)
  })
}