Skip to content

Instantly share code, notes, and snippets.

@yudai
Created August 9, 2015 23:34
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 yudai/0d7287ee78625b247856 to your computer and use it in GitHub Desktop.
Save yudai/0d7287ee78625b247856 to your computer and use it in GitHub Desktop.
func (r *Runner) Start(handler func([T]), channel chan [T]) {
go func() {
for {
select {
case i := <-runner.Interrupt:
return
case msg := <-channel
handler(msg)
}
}
}()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment