Last active
August 11, 2019 20:32
-
-
Save R4wm/3d41a5b9bac63e8263043da02d5ec629 to your computer and use it in GitHub Desktop.
blocking channel demonstration
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" | |
const mock = "haha you waited" | |
func main() { | |
c := make(chan string) | |
go func() { | |
fmt.Println("go routing was run") | |
// Leveraging closure here with c | |
c <- mock | |
}() | |
fmt.Printf("Ublocking the channel now from main: %s\n", <-c) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Blocking demonstration