go version
go version go1.6.3 linux/amd64
uname -r
3.13.0-95-generic
Below code is using 100% cpu (1 full core)
package main
import (
"fmt"
"os"
"time"
)
func main() {
channel := make(chan bool, 1)
go doSomething(channel)
for {
select {
case <-channel:
fmt.Println("Go routine has ended")
os.Exit(0)
default:
}
}
}
func doSomething(ch chan bool) {
time.Sleep(60000 * time.Millisecond)
ch <- true
}
Please let me know if you what is happening above.