Created
March 19, 2016 07:35
-
-
Save atton/b3c919ad64de994b06c8 to your computer and use it in GitHub Desktop.
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 characters
package main | |
import "fmt" | |
import "time" | |
func yo(c chan int) { | |
fmt.Printf("%d\n", <-c) | |
} | |
func main() { | |
c := make(chan int, 0) // dead lock | |
//c := make(chan int, 1) // ok | |
c <- 100 | |
go yo(c) | |
time.Sleep(time.Second * 1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment