Skip to content

Instantly share code, notes, and snippets.

@jlouis
Created November 16, 2009 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlouis/235612 to your computer and use it in GitHub Desktop.
Save jlouis/235612 to your computer and use it in GitHub Desktop.
package main
import (
"fmt";
)
func worker (i int, c chan bool) () {
fmt.Printf("%d\n", i);
c <- true;
}
func main () {
c := make(chan bool);
for i := 0; i < 100; i++ {
go worker(i, c);
}
for i := 0; i < 100; i++ {
<-c;
}
fmt.Printf("Drained\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment