# LibTmux.Pane.WaitUntilAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Pane.Waiting.cs#L191
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-pane-waituntilasync/

```
LibTmux.Pane.WaitUntilAsync(condition: Func<IReadOnlyList<string>, bool>, timeout: TimeSpan, cancellationToken: CancellationToken) -> Task<PaneWaitResult>
```

Waits until a condition holds over the rows the pane shows.

The condition is tested when the wait begins and again each time the
pane prints or changes state, so a screen that is already right ends the
wait at once as <see cref="PaneWaitOutcome.PresentAtEntry" />. Unlike
<see cref="WaitForTextAsync(PaneWaitRequest, CancellationToken)" />, it
sees the whole screen, including rows a full-screen program redraws.
A program that exits leaving a screen the condition accepts ends the
wait as <see cref="PaneWaitOutcome.Matched" />, not
<see cref="PaneWaitOutcome.PaneExited" />.

## Parameters

- `condition` (`Func<IReadOnlyList<string>, bool>`): Judges the visible rows, top to bottom.
- `timeout` (`TimeSpan`): How long to wait.
- `cancellationToken` (`CancellationToken`): Stops the wait.

## Returns

How the wait ended.

## Raises

- [`ArgumentOutOfRangeException`](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception): The timeout is negative or longer than 49 days.
- [`TmuxTransportException`](/en/csharp/latest/reference/libtmux-tmuxtransportexception/): Control observation failed.
- [`TmuxObjectNotFoundException`](/en/csharp/latest/reference/libtmux-tmuxobjectnotfoundexception/): tmux no longer has the pane when the wait begins.
