FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    spawn_on

    function · ferroui-system · v0.5.0

    fn spawn_on<C, F>(create: C, schedule: std::sync::Arc<dyn Schedule>) -> super::join::JoinHandle<<F as >::Output>
    where C: FnOnce() -> F + Send + 'static,
          F: Future + 'static,
          <F as >::Output: Send + 'static
    

    Runs the future that create makes as a task of the thread of schedule, and gives its handle, from any thread: create is Send, the future it makes need not be. The schedule is given one piece of work that, on its thread, calls create and polls the future at once (both inside that work, as FirstPoll::Now does inside a spawning call); every later wake queues a poll there, as for spawn_local_on.

    The task ends canceled when it is aborted before that work runs, or when the schedule drops the work without running it (a dispatcher that has shut down); a panic of create faults it like a panic of the future.

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.