Commit 50484644 authored by Brendan Burns's avatar Brendan Burns

Add Forever, syntactic sugar on Until

parent fa9339d9
......@@ -94,6 +94,11 @@ func logError(err error) {
// NeverStop may be passed to Until to make it never stop.
var NeverStop <-chan struct{} = make(chan struct{})
// Forever is syntactic sugar on top of Until
func Forever(f func(), period time.Duration) {
Until(f, period, NeverStop)
}
// Until loops until stop channel is closed, running f every period.
// Catches any panics, and keeps going. f may not be invoked if
// stop channel is already closed. Pass NeverStop to Until if you
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment