Releases: codeclysm/cc
Releases · codeclysm/cc
Fix a out of stack issue
v1.2.2 Goroutines are started only when they can be ran
Support multiple funcs in Stoppable
v1.2.1 Support multiple parallel functions to StoppableFunc
Add Stoppable functions
stoppable := cc.Run(func(stop chan struct{}) {
i := 0
L:
for {
select {
case <-stop:
fmt.Println("receive stop signal")
break L
default:
i++
time.Sleep(250 * time.Millisecond)
fmt.Println(i)
}
}
fmt.Println("finished with", i)
})
go func() {
time.Sleep(1 * time.Second)
fmt.Println("send stop signal")
stoppable.Stop()
stoppable.Stop() // It shouldn't explode even if you attempt to close it multiple times
}()
<-stoppable.Stopped
fmt.Println("stopped finally")
// Output: 1
// 2
// 3
// send stop signal
// 4
// receive stop signal
// finished with 4
// stopped finallyUse a concurrent multierror
v1.1.0 Use a concurrentmultierror
v1.0.0
Add readme