Skip to content

Instantly share code, notes, and snippets.

@gitschaub
Created July 19, 2016 00:55
Show Gist options
  • Save gitschaub/3ecdebd4e9291f62cefb7b0544f851fb to your computer and use it in GitHub Desktop.
Save gitschaub/3ecdebd4e9291f62cefb7b0544f851fb to your computer and use it in GitHub Desktop.
//program
func do(s string, i int) {
fmt.Printf("%s_%d\n", s, i)
}
func main() {
for i := 0; i < 5; i++ {
go do("Hello", i)
go do("World", i)
}
}
//always the same output with GOMAXPROCS=1
World_4
Hello_0
World_0
Hello_1
World_1
Hello_2
World_2
Hello_3
World_3
Hello_4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment