Skip to main content

spawn_automaton_task

Function spawn_automaton_task 

Source
pub fn spawn_automaton_task<A>(
    automaton: A,
    interval: Duration,
    value_tx: Sender<f64>,
    cancel_rx: Receiver<bool>,
) -> JoinHandle<()>
where A: Automaton + 'static,
Expand description

Run an automaton as a green thread (tokio task)

§Arguments

  • automaton — implementation of the Automaton trait
  • interval — update frequency (e.g. 10 ms for 100 Hz)
  • value_tx — channel for sending values to PortCombiner
  • cancel_rx — cancellation signal (from PortCombinerHandle::cancel_rx)

Returns a JoinHandle. Dropping the handle does not stop the task. Use the cancellation signal to stop it.