https://github.com/cloud-org/go-timewheel
fork from rfyiamcool/go-timewheel and modify by ashing
https://github.com/cloud-org/go-timewheel
go timer timewheel
Last synced: 10 months ago
JSON representation
fork from rfyiamcool/go-timewheel and modify by ashing
- Host: GitHub
- URL: https://github.com/cloud-org/go-timewheel
- Owner: cloud-org
- Created: 2022-04-07T08:54:01.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-07T09:23:37.000Z (about 4 years ago)
- Last Synced: 2024-10-12T09:09:25.534Z (over 1 year ago)
- Topics: go, timer, timewheel
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### go-timewheel
自用魔改时间轮。
#### usage
```go
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()
}
```