# LibTmux.TmuxWait.UntilAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Waiting/TmuxWait.cs#L25
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-tmuxwait-untilasync/

```
LibTmux.TmuxWait.UntilAsync(probe: Func<CancellationToken, Task<bool>>, timeout: TimeSpan, interval: TimeSpan, throwOnTimeout: bool, cancellationToken: CancellationToken) -> Task<bool>

LibTmux.TmuxWait.UntilAsync(probe: Func<CancellationToken, Task<T>>, predicate: Func<T, bool>, timeout: TimeSpan, interval: TimeSpan, cancellationToken: CancellationToken) -> Task<T>
```

Waits until a probe reports the state was reached.

## Parameters

- `probe` (`Func<CancellationToken, Task<bool>>`): Answers whether the state has been reached. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)
- `timeout` (`TimeSpan`): How long to keep asking. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)
- `interval` (`TimeSpan`): How long to wait between askings. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)
- `throwOnTimeout` (`bool`): Whether running out is a failure. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)
- `cancellationToken` (`CancellationToken`): Cancels the wait.
- `probe` (`Func<CancellationToken, Task<T>>`): Reads the current value. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)
- `predicate` (`Func<T, bool>`): Answers whether a reading is the wanted one. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)
- `timeout` (`TimeSpan`): How long to keep reading. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)
- `interval` (`TimeSpan`): How long to wait between readings. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)

## Returns

True when the state was reached. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)

The first reading the predicate accepted. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)

## Raises

- [`TmuxWaitTimeoutException`](/en/csharp/latest/reference/libtmux-tmuxwaittimeoutexception/): The state was not reached and running out was to be a failure. (for `UntilAsync(probe, timeout, interval, throwOnTimeout, cancellationToken)`)
- [`TmuxWaitTimeoutException`](/en/csharp/latest/reference/libtmux-tmuxwaittimeoutexception/): No reading was accepted in time. (for `UntilAsync(probe, predicate, timeout, interval, cancellationToken)`)
