Created
July 19, 2016 00:55
-
-
Save gitschaub/3ecdebd4e9291f62cefb7b0544f851fb to your computer and use it in GitHub Desktop.
This file contains 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 characters
//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