Server.wait_for
Block until someone signals this channel, or the deadline passes.
Source and package
- [[
C++ nodiscard attributeAsks the compiler to warn when a result is discarded. An explicit cast to void acknowledges that the result is intentionally ignored.]] expected<void, CommandFailure > wait_for(std::string channel, std::_view optional <std::chrono:: > timeout = {}) const;milliseconds -
Description#
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
timeoutwaits 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.- Parameters
tmux command#
The tmux commands behind wait_for.
tmux C API#
The C declarations in tmux that implement these commands.
Guides#
Pages that discuss wait_for.
In other ports#
Wait for, signal or lock a channel
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Ruby | Lib |
| Erlang | tmux Builds a command value; construction performs no I/O. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | no equivalent on Server |
| Rust | server |
| Go | tmux |
| Java | no equivalent on Server |
| C# | Lib |
| Swift | Server |
| OCaml | Libtmux |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |
No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.