# libtmux::Server::wait_for

- **Module:** libtmux::Server
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/393d4b0ad666f18a6581f1eb281741a75a7503f0/include/libtmux/server.hpp#L293
- **Page:** https://libtmux.org/en/cxx/latest/reference/libtmux-server-wait_for/

```
libtmux::Server::wait_for(channel: std::string_view, timeout: std::optional< std::chrono::milliseconds > = {}) -> expected< void, CommandFailure >
```

Block until someone signals this channel, or the deadline passes.

tmux latches a signal: one sent while nobody is waiting satisfies the next wait rather than being lost. That makes signal-before-wait safe, and it also means a stale signal can release a later waiter, so a channel is worth naming for one exchange rather than reusing.

A server that dies under a waiter makes tmux exit zero, which is indistinguishable from being signalled — a caller would carry on as though the other side had spoken. This reports that as a failure instead, which is the reason to prefer it over running the command.

Omitting `timeout` waits with no deadline: if the channel is never signalled, this call never returns. Waiting is the whole point of the request, so that is deliberate rather than a gap — pass a timeout to bound it.
