# tmux.Poll

- **Module:** tmux
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/poll.go#L26
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-poll/

```
tmux.Poll(ctx: context.Context, interval: time.Duration, condition: func(context.Context) (bool, error)) -> error
```

Poll checks condition immediately and then after each interval, until it reports true, returns an error, or ctx ends.

A condition receives ctx and must observe cancellation itself; Poll cannot
interrupt one already running. Poll returns condition errors unchanged and
ctx.Err when ctx ends first.

Poll is for a state tmux does not announce. Waiting for a pane to print
something is not one: [PaneObservation.WaitFor] is woken by tmux as the
pane writes, where a poll re-reads the screen on a guess and can match a
shell's echo of what was typed. [Server.WaitFor] waits on tmux's separate
wait-for channel.
