Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func Go ¶
Go starts the given function in a goroutine and adds the ability to stop it gracefully.
In your runner listen for the stop channel to be closed, then call finish() to stop the runner.
Example:
task := Go(func(stop StopChan, finish Finish) { for { select { case _, ok := <-stop: if !ok { finish() return } } } }
Click to show internal directories.
Click to hide internal directories.