# libtmux:lock-session

- **Package:** libtmux
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/server-operations.lisp#L98
- **Public owner:** libtmux
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-lock-session/

```
(lock-session client session &key cancel-token timeout output-limit)
```

Request locking of SESSION's attached frontends; return a COMMAND-OUTCOME.
CLIENT must own the captured SESSION. The live session membership determines
which frontends receive the request. Each runs its configured lock-command;
control clients, suspended frontends and empty/oversized commands are skipped.
Success acknowledges the request, not startup, completion or authentication.
Blocks under shared preflight/dispatch limits and returns no replacement.
Foreign or vanished sessions signal STALE-TARGET; other failures retain their
outcome. Lock programs belong to the frontends; closing CLIENT leaves them
running. Never retries.

See also: `libtmux:error-outcome`, `libtmux:lock-client`, `libtmux:lock-server`, `libtmux:outcome-status`, `libtmux:set-option`.

## Parameters

- `client`
- `session`
- `cancel-token?`
- `timeout?`
- `output-limit?`

## tmux command

The tmux commands behind `lock-session`.

- [`lock-session`](/en/tmux/latest/manual/lock-session/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_lock_session_entry`](/en/tmux/latest/reference/c-variable-cmd_lock_session_entry/) (attribute)
- [`cmd_lock_server_exec`](/en/tmux/latest/reference/c-function-cmd-lock-server-c-cmd_lock_server_exec/) (function)

## Guides

Pages that discuss `lock-session`.

- [Explicit operations](/en/lisp/latest/guides/operations/)
