1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use ;
static NEXT_SESSION_RECENCY: AtomicU64 = new;
/// Opaque process-local total order over session recency events.
///
/// Public session times are whole Unix seconds, so `session_created` and
/// `session_activity` cannot order two events inside the same second. tmux
/// compares full `timeval` values instead, which is why it ranks the last of
/// three same-second sessions first. This token restores that total order: it
/// is an internal workspace key, never serialized, rendered or compared across
/// processes, so it adds no public format, option or wire value of its own.
///
/// It does not follow that the surrounding behavior is unchanged. One of the
/// events that mints a token — an attached client's accepted interaction —
/// also advances the public `activity_at` through [`Session::touch_activity`],
/// which `#{session_activity}` and the `list-sessions` payload publish. That
/// is a deliberate, tmux-measured change to observable output; only the token
/// itself is invisible.
///
/// Only a lifetime or accepted-interaction event mints a new token. Renaming a
/// session, synchronizing grouped windows, pane output and detaching all leave
/// the existing token in place.
///
/// The order is total only while no two stored sessions hold the same token.
/// `Session` is publicly cloneable, so a session can arrive at a store already
/// carrying a live token; [`SessionStore::insert_existing_session`] re-mints on
/// that collision, because readers break an equal-token tie differently — some
/// on the creation id, some on the name — and would disagree.
///
/// [`Session::touch_activity`]: crate::Session::touch_activity
/// [`SessionStore::insert_existing_session`]: crate::SessionStore::insert_existing_session
;