# set_thread_schedule

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

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

```rust
fn set_thread_schedule(schedule: Option<std::sync::Arc<dyn Schedule>>)
```

Makes `schedule` the schedule of the current thread, `None` removes it: when a wake of a task
of the thread's queue, or a callback of the thread (`CancellationToken::register_local`), comes
from another thread, the schedule is given work that runs [`run_pending`](/docs/0.5.0/api/ferroui-system/task/function-run_pending/). When a schedule is
set, the wakes that are waiting already run at once. A dispatcher is the schedule of its thread
from its start to its shutdown.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/executor.rs#L578)

## Availability

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