Created
August 9, 2015 23:34
-
-
Save yudai/0d7287ee78625b247856 to your computer and use it in GitHub Desktop.
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 (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