Last active
December 18, 2015 22:09
-
-
Save Mitmischer/5852217 to your computer and use it in GitHub Desktop.
Go zersetzt mein Gehirn!
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
package main | |
import "fmt" | |
// works | |
func main(){ | |
c := make(chan int) | |
go func(c chan int){ | |
fmt.Println(<-c) | |
}(c) | |
go func(){ | |
c <- 2 | |
}() | |
} | |
// deadlock! | |
//func main(){ | |
// c := make(chan int) | |
// go fmt.Println(<-c) | |
// go func(){ | |
// c <- 2 | |
// }() | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment