[][src]Function kwait::jitter_until

pub fn jitter_until<F>(
    f: F,
    period: Duration,
    jitter_factor: f64,
    sliding: bool,
    stop_ch: Receiver<bool>
) where
    F: Fn(), 

jitter_until loops until stop channel is closed, running f every period.

If jitter_factor is positive, the period is jittered before every run of f. If jitter_factor is not positive, the period is unchanged and not jittered.

If sliding is true, the period is computed after f runs. If it is false then period includes the runtime for f.

Close stop_ch to stop. f may not be invoked if stop channel is already closed. Pass NeverStop to if you don't want it stop.