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.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to