Deadlock with no coroutines started when calling goccm.WaitAllDone()
Closed this issue · 1 comments
StephanieSunshine commented
Why is this causing a deadlock? I would assume that this would pass cleanly because no coroutines were started/nothing to wait for. I don't know what it would be deadlocking on. Is there something I'm missing?
func main() {
threads := goccm.New(16)
threads.WaitAllDone()
fmt.Println("Hello, playground")
}
Error from Go Playground:
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/zenthangplus/goccm.(*concurrencyManager).WaitAllDone(...)
/tmp/gopath2369581906/pkg/mod/github.com/zenthangplus/goccm@v1.1.3/goccm.go:135
main.main()
/tmp/sandbox815748461/prog.go:11 +0x59
goroutine 18 [chan receive]:
github.com/zenthangplus/goccm.(*concurrencyManager).controller(0xc00010a000)
/tmp/gopath2369581906/pkg/mod/github.com/zenthangplus/goccm@v1.1.3/goccm.go:72 +0x30
created by github.com/zenthangplus/goccm.New
/tmp/gopath2369581906/pkg/mod/github.com/zenthangplus/goccm@v1.1.3/goccm.go:62 +0x176
StephanieSunshine commented
I found a work around, I'm not sure if it's the proper way to be doing this, but if you call goccm.RunningCount() and it happens to be non zero, then goccm.WaitAllDone() doesn't seem to deadlock.