# session_detach

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L349
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-session_detach/

```c
int session_detach(struct session *s, struct winlink *wl)
```

## Parameters

- `s` (`struct session *`)
- `wl` (`struct winlink *`)

## Called by

- [`server_kill_window`](/en/tmux/3.2a/reference/c-function-server_kill_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/server-fn.c#L207)
- [`server_unlink_window`](/en/tmux/3.2a/reference/c-function-server_unlink_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/server-fn.c#L301)

## Calls

- [`notify_session_window`](/en/tmux/3.2a/reference/c-function-notify_session_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L357)
- [`session_destroy`](/en/tmux/3.2a/reference/c-function-session_destroy/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L364)
- [`session_group_synchronize_from`](/en/tmux/3.2a/reference/c-function-session_group_synchronize_from/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L361)
- [`session_next`](/en/tmux/3.2a/reference/c-function-session_next/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L354)
- [`winlink_remove`](/en/tmux/3.2a/reference/c-function-winlink_remove/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L359)
- [`winlink_stack_remove`](/en/tmux/3.2a/reference/c-function-winlink_stack_remove/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/session.c#L358)

## Other function references

- [`session_last`](/en/tmux/3.2a/reference/c-function-session_last/) (function)
- [`session_previous`](/en/tmux/3.2a/reference/c-function-session_previous/) (function)

## Referenced by

- [`session_new`](/en/tmux/3.2a/reference/c-function-session_new/) (function)

## Referenced declarations

- [`session.curw`](/en/tmux/3.2a/reference/c-struct-session-curw/) (attribute)
- [`winlink.flags`](/en/tmux/3.2a/reference/c-struct-winlink-flags/) (attribute)
- [`session.lastw`](/en/tmux/3.2a/reference/c-struct-session-lastw/) (attribute)
- [`session`](/en/tmux/3.2a/reference/c-struct-session/) (struct)
- [`winlink.window`](/en/tmux/3.2a/reference/c-struct-winlink-window/) (attribute)
- [`session.windows`](/en/tmux/3.2a/reference/c-struct-session-windows/) (attribute)
- [`winlink`](/en/tmux/3.2a/reference/c-struct-winlink/) (struct)
- [`WINLINK_ALERTFLAGS`](/en/tmux/3.2a/reference/c-define-tmux-h-winlink_alertflags/) (constant)
