Skip to content

Instantly share code, notes, and snippets.

@fabioxgn
Created May 21, 2014 02:13
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 fabioxgn/41396447ad818c262b54 to your computer and use it in GitHub Desktop.
Save fabioxgn/41396447ad818c262b54 to your computer and use it in GitHub Desktop.
First time using channels
func execute(cmd *Cmd, conn ircConnection) {
done := make(chan bool, len(list))
for k, v := range list {
cmdName := k
cmdFunc := v
go func() {
result := cmdFunc(cmd)
conn.Privmsg(cmd.Channel, result)
done <- true
}()
}
for _, _ = range passiveCommands {
<-done
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment