Skip to content

Instantly share code, notes, and snippets.

@fabioxgn
Created May 21, 2014 02:13
Show Gist options
  • 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