Skip to content

Instantly share code, notes, and snippets.

@hachibeeDI
Created October 19, 2013 13:54
Show Gist options
  • Save hachibeeDI/7056161 to your computer and use it in GitHub Desktop.
Save hachibeeDI/7056161 to your computer and use it in GitHub Desktop.
pattern of wait for goroutine finished
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