# spawn_on

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/task/function-spawn_on/

**function** · [`ferroui-system`](/docs/0.5.0/api/ferroui-system/) · v0.5.0

```rust
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`](/docs/0.5.0/api/ferroui-system/task/function-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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/executor.rs#L494)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
