Created
October 19, 2013 13:54
-
-
Save hachibeeDI/7056161 to your computer and use it in GitHub Desktop.
pattern of wait for goroutine finished
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
func routine(quit chan int) { | |
// do stuff | |
quit <- 1 | |
} | |
func main() { | |
routineQuit := make(chan int) | |
go routine(routineQuit) | |
<-routineQuit // blocks until quit is written to | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment