Module interval_task::channel
source · Expand description
§channel
This is a wrapper of runner.
It returns sender & receiver created by async_channel, and a Runner instance that implements ExternalRunnerExt.
It will send TASK_SIGNAL signal and wait for TASK_DONE signal repeatedly every fixed Duration .
§Example
let (r, mut runner) = channel::new(Duration::from_micros(1_000_000 / 120));
runner.start().unwrap();
let start = Instant::now();
for _ in 0..120 {
r.recv_blocking().unwrap();
}
println!("Elapsed: {:?}", start.elapsed());
runner.close().unwrap();Constants§
Functions§
- Create a
runner::Runner. Signals everyinterval.