5 ms·
Here's a minimal example: package main import "fmt" func main() { go hog() for i := 0; ; i++ { fmt.Println(i) } } func hog() {
by it 10y ago
Here's a minimal example:
package main
import "fmt"
func main() {
go hog()
for i := 0; ; i++ {
fmt.Println(i)
}
}
func hog() {
for {
}
}
It stalls after about three seconds on go version 1.6.
Here's the issue on github:
https://github.com/golang/go/issues/543 https://github.com/golang/go/issues/543
- it 10y agoHere's a modified version that doesn't stall: package main import "fmt" import "runtime" func main() { go hog() for i := 0; ; i++ { fmt.Println(i) } } func hog() { for { runtime.Gosched() } }