# libtmux::Connection

- **Module:** libtmux
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/393d4b0ad666f18a6581f1eb281741a75a7503f0/include/libtmux/control.hpp#L340
- **Page:** https://libtmux.org/en/cxx/latest/reference/libtmux-connection/

One held-open control client.

Shared freely between threads. `execute`, `take_notifications`, `wait_for_notifications`, `watch_notifications`, `set_pane_output` and the muting pair may all be called at once: writes are serialized, and each reply is matched to its own request through a private boundary, which is what lets concurrent callers tell their blocks apart even though tmux puts no request id on a guard.

Moving from a connection, or destroying one, may not race with any of those — the same rule `CommandRuntime` states for itself.

It remains one FIFO client, so a command that waits on the server also delays whatever another thread asked for next. That is why `Server::run` stays the surface for a command whose final result matters.

## Members

- `connect` (method)
- `~Connection` (method)
- `Connection` (method)
- `execute` (method): Completes at this request's private protocol boundary and preserves every guarded block before it.
- `take_notifications` (method): Every outside-block event tmux has written since the last call.
- `watch_notifications` (method): Open an independent cursor at the next outside-block event.
- `wait_for_notifications` (method): The same, but waits for something to arrive.
- `notification_fd` (method): A descriptor that is readable exactly when a take would return something.
- `set_pane_output` (method): Stop or resume `output` for one pane, on a connection that asked for it.
- `mute_pane_output` (method): Named forms of set_pane_output; the same connection policy applies.
- `resume_pane_output` (method)
- `events` (method): Everything tmux says until the deadline, as one loop rather than two.
- `dropped_notifications` (method): How many outside-block events this Connection's legacy taking cursor missed to keep the shared log bounded.
- `native_child_pid` (method)
- `shutdown` (method)
