# AsyncLock

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactive/concurrency/struct-asynclock/

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

```rust
struct AsyncLock
```

Runs queued actions one at a time (`AsyncLock`).

Upstream serializes threads with a lock; on one thread the lock is the re-entrancy guard: an
action queued from inside another runs when that one has returned. A panicking action leaves
the lock faulted: the actions still queued are dropped and later ones are ignored, as upstream
clears its queue and ignores later calls after an exception.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/concurrency/async_lock.rs#L14)

## Members

- [`new`](#function-new)
- [`wait`](#function-wait)
- [`dispose`](#function-dispose)

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

### new

```rust
fn new() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/concurrency/async_lock.rs#L21)

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

### wait

```rust
fn wait(self: &Self, action: impl FnOnce() -> () + 'static)
```

Queues `action` and runs the queue if no action is running (`Wait`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/concurrency/async_lock.rs#L26)

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

### dispose

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

Drops the queued actions and ignores later ones (`Dispose`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/concurrency/async_lock.rs#L55)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `Default`

## Availability

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