Created
May 21, 2014 02:13
-
-
Save fabioxgn/41396447ad818c262b54 to your computer and use it in GitHub Desktop.
First time using channels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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