Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pattern to start all go routines only after all are created
// Pattern to start all go routines only after all are created.
func goRoutine() {
<-start
// do whatever
}
func main() {
start := make(chan, struct{})
for i:=0; i<100; i++ {
go goRoutine()
}
close(start)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.