Created
August 1, 2013 13:48
-
-
Save cloudaice/6131509 to your computer and use it in GitHub Desktop.
Revisions
-
cloudaice created this gist
Aug 1, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ package main import "fmt" import "time" import "runtime" func main(){ runtime.GOMAXPROCS(8) channel := make(chan string) for i:=0; i<5; i++ { go func (id int) { for { time.Sleep(3) msg := <-channel fmt.Println(msg, id) } }(i) } ticker := time.NewTicker(time.Second) for t := range ticker.C { fmt.Println(t) channel <- "hello world" } }