# LibTmux.ServerMirror.WaitUntilAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Snapshots/ServerMirror.cs#L206
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-servermirror-waituntilasync/

```
LibTmux.ServerMirror.WaitUntilAsync(condition: Func<ServerMirrorView, bool>, timeout: TimeSpan, cancellationToken: CancellationToken) -> Task<ServerMirrorView>
```

Waits until a view satisfies a condition, testing the current view first.

## Parameters

- `condition` (`Func<ServerMirrorView, bool>`): Judges each view.
- `timeout` (`TimeSpan`): How long to wait, or <see cref="Timeout.InfiniteTimeSpan" />.
- `cancellationToken` (`CancellationToken`): Stops waiting.

## Returns

The first view the condition accepts.

## Raises

- [`TmuxWaitTimeoutException`](/en/csharp/latest/reference/libtmux-tmuxwaittimeoutexception/): No view satisfied the condition in time.
- [`InvalidOperationException`](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception): The mirror ended first; its failure, if any, is the inner exception.
