[go-nuts] Re: Why a single go routine with sleep is using 100% cpu (1 core)

2016-09-11 Thread Sagar P.
Ah, I see my mistake. Removed default to avoid a busy-loop. Thanks! On Sunday, September 11, 2016 at 4:11:26 PM UTC-7, Sagar P. wrote: > > 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) >

[go-nuts] Why a single go routine with sleep is using 100% cpu (1 core)

2016-09-11 Thread Sagar P.
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 <-chann