Skip to content

Instantly share code, notes, and snippets.

@kowey
Created June 28, 2012 10:51
Show Gist options
  • Save kowey/3010649 to your computer and use it in GitHub Desktop.
Save kowey/3010649 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"strconv"
)
func whatever(c chan string, thr int) {
for i := 0; i < 100; i++ {
fmt.Printf("%d\n", i)
}
c <- "Thread " + strconv.Itoa(thr) + " done!"
}
func main() {
c := make(chan string)
for i := 0; i < 4; i++ {
go whatever(c, i)
}
for g := 0; g < 4; g++ {
fmt.Printf("%v\n", <-c)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment