# SynchronizationContext

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/threading/trait-synchronizationcontext/

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

```rust
trait SynchronizationContext: Send + Sync
```

Where posted work runs (`System.Threading.SynchronizationContext`).

The base class of .NET posts to the thread pool and sends on the calling thread; here every
implementation says where its work runs. An implementation is shared between threads, as the
contexts of .NET are.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L44)

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

## Members

- [`post`](#function-post)
- [`send`](#function-send)
- [`post_local`](#function-post_local)
- [`send_local`](#function-send_local)
- [`operation_started`](#function-operation_started)
- [`operation_completed`](#function-operation_completed)

<a id="function-post"></a>

### post

```rust
fn post(self: &Self, work: Box<dyn FnOnce() -> () + Send>)
```

Queues `work` to run on the context, from any thread, without waiting for it (`Post`).

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L46)

<a id="function-send"></a>

### send

```rust
fn send(self: &Self, work: Box<dyn FnOnce() -> () + Send>)
```

Runs `work` on the context, from any thread, and waits for it (`Send`).

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L49)

<a id="function-post_local"></a>

### post_local

```rust
fn post_local(self: &Self, work: Box<dyn FnOnce() -> ()>)
```

Queues `work`, which is not `Send`, to run on the context (`Post` from the thread of the
context). Implementations may panic when it is called from another thread.

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L53)

<a id="function-send_local"></a>

### send_local

```rust
fn send_local(self: &Self, work: Box<dyn FnOnce() -> ()>)
```

Runs `work`, which is not `Send`, on the context and waits for it (`Send` from the thread of
the context). Implementations may panic when it is called from another thread.

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L57)

<a id="function-operation_started"></a>

### operation_started

```rust
fn operation_started(self: &Self)
```

Tells the context that an operation has started (`OperationStarted`); nothing by default.

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L60)

<a id="function-operation_completed"></a>

### operation_completed

```rust
fn operation_completed(self: &Self)
```

Tells the context that an operation has completed (`OperationCompleted`); nothing by
default.

> **Deprecated since 0.5.0.** use a `ferroui_system::task::Schedule`: the dispatcher's `task_schedule(priority)`, `task::current_schedule()` and `Schedule::schedule_local`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/synchronization_context.rs#L64)

## Availability

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