summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 06:20:16 -0300
committerGabriel Schneider <[email protected]>2026-11-18 08:01:10 -0300
commit96e8398a38bba02e0ea5a9e59c14016dba270531 (patch)
tree894ad68f24641e73d4c50e21e408289c1bf82cbc /src/replica.zig
parent46952caa8e7087c27dea55b25f067e1bad06b859 (diff)
downloadpardes-96e8398a38bba02e0ea5a9e59c14016dba270531.tar.gz
pardes-96e8398a38bba02e0ea5a9e59c14016dba270531.zip
session: a detached session's terminal deltas go a unit a frame, as a terminal's frame paces its output (waitInput), not a unit and a delta for every pty read: the unit sent at the step boundary is its clients' frame (drawn_ns), a client's acknowledgement of a delta no longer counts as an input (Peers.urgent: an input or a join wakes the step at once, an ack waits for the next frame), and its clients' echo is the frame's after an input (pardes.frame_ns, where a terminal of its own keeps its second); a session with no client and the own frontend's loop are as they were. cat of 20,000 lines in a shell pane of a client, tty, ReleaseFast, per cat: the session's own instructions on top 313.8M -> 74.8M (boundaries 9,165 -> 1,515 and units 11,460 -> 3,807 over the whole run), the client's 1,605M -> 145.7M with the client's loop change below it (own 115.3M); settled wall min 71.6 -> 35.1 ms, median 179.6 -> 131.9 ms (own 16.8 / 17.9; load 4-27, to retake quiet); window client's cat session 113.3M -> 81.5M
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/replica.zig b/src/replica.zig
index dbdc3146..2cc7dd55 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -1923,6 +1923,10 @@ pub const Peers = struct {
taken: std.ArrayListUnmanaged(Note) = .empty,
/// A reader posted: the loop's one test a step while nothing is attached.
mail: std.atomic.Value(bool) = .init(false),
+ /// ...and what it posted was a client's input or a join, which the
+ /// session steps at once; a terminal's acknowledgement waits for the
+ /// session's next frame, as its output does (tui.zig `waitInput`).
+ urgent: std.atomic.Value(bool) = .init(false),
/// Wakes the session's loop (its wait for input) from a reader.
wake_ctx: ?*anyopaque = null,
wake: ?*const fn (?*anyopaque) void = null,
@@ -1972,6 +1976,7 @@ pub const Peers = struct {
return;
};
ps.mail.store(true, .release);
+ if (note != .screen) ps.urgent.store(true, .release);
ps.lock.unlock(ps.io);
if (ps.wake) |w| w(ps.wake_ctx);
}