diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 14:43:18 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 15:22:25 -0300 |
| commit | 4ae132650106242a5130aad5230c4f429bf02b29 (patch) | |
| tree | 0bbb733990ac65a00f15f786741015726a9ee4d0 /dev | |
| parent | 6fdf2bf2b1a90714ba998fa959db33089abb9f56 (diff) | |
| download | pardes-4ae132650106242a5130aad5230c4f429bf02b29.tar.gz pardes-4ae132650106242a5130aad5230c4f429bf02b29.zip | |
replica, gui, tui: the clock a session's pump reads after its wait is held only while a client's post waits for it (Peers.heldNow, which both shells' clocks call), so a wait that ran out always reads the clock and its step meets the deadline it waited for: a window's session showing a PDF with a client attached stepped ~700 times a second with nobody typing, each step a unit every client replayed (the multi-client line's "a PDF in a window's session floods every client"); RUN (an instrumented Debug build, the window's loop offscreen with no test mode, a terminal client; .scratch reorg/pardes-idle-flood/runs/probe): the client's view of the PDF (pane 1, view 1: 78x9, 8x16, glyphs) owed to the kind from its join on (Kind.wake: now, so nextWake a frame on), and 2247 of 2268 pumps 'mail_only true, mail false, wait ran out', the clock read after each the one held at the join (1.302 s while the real one ran to 2.93 s), so advance never reached the deadline, the view was never told, and the next wait was 1 ms: for ever; THE CAUSE: dev/gui/gui.zig guiNow held the clock after any wait whose `mail_only` was still set, and waitInput sets it at a wait's start and clears it only for an event that is not a replica's wake or a queue message: a wait that ran out (SDL_WaitEventTimeout false, waitDetached's too) took no post and still held the clock; a terminal's session never did (its wait ends in a .wake event, tui.zig apply clears it); THE FIX: Peers.heldNow (core/replica.zig): held only when the wait took nothing else (the shell's `mail_only`), a client is attached (`recording`), a post waits to be taken (`mail`, set by post, cleared at the boundary) and the clock has started; gui.zig guiNow and tui.zig clockNow call it (their own copies of the rule gone), so no shell's wait can hold the clock without a post; TEST FIRST: test/panes.zig "a PDF shown and a client's view its kind was not told: the session's next pump, its wait run out with nobody typing, tells it, and nothing is owed after; a client's post waiting holds the clock" (on the base's rule, the same function without `mail`: fails at panes.zig:4120, the view still owed after the pump); test/daemon.py --client-idle on this build: the window's loop 7 boundaries and 8 units with a PDF against the text alone's 5 and 6 (4871 and 4872 on the base), the test surface 223 against 207 (388 against 206), the terminal's 8 against 5; a user hit it: every window's session with a client attached and a deadline owed (a PDF's view, a message's linger, a Life's tick, a look's hover) stepped and sent a unit a millisecond until someone typed in the window
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/gui/gui.zig | 7 | ||||
| -rw-r--r-- | dev/tui/tui.zig | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 9ea813fc..8fd8c24c 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -2457,9 +2457,8 @@ const Shell = struct { /// of their own with no window here; the session loop's /// (runtime/session.zig), a client's none. peers: *replica.Peers, - /// This wait took only a replica's post (its input, its join): the pump - /// after it reads no new time, so it moves nothing the replicas' - /// speculations stand on (tui.zig's `mail_only`). + /// This wait took nothing but a replica's post, if one (its input, its + /// join): the pump after one reads no new time (Peers.heldNow). mail_only: bool = false, waited: bool = false, /// With replica clients, a wait takes one person's input (tui.zig @@ -3167,7 +3166,7 @@ fn guiNow(ctx: ?*anyopaque) u64 { const s = shellOf(ctx); if (s.waited) { s.waited = false; - if (s.mail_only and s.peers.count() > 0 and s.core.clock.started) return s.core.clock.now_ns; + if (s.peers.heldNow(s.core, s.mail_only)) |held| return held; } return s.test_clock orelse s.paced_ns orelse c.SDL_GetTicksNS(); } diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig index e2cdd2fa..312a0846 100644 --- a/dev/tui/tui.zig +++ b/dev/tui/tui.zig @@ -1240,9 +1240,8 @@ const Shell = struct { /// The session's replica clients (core/replica.zig), on sockets: the /// session loop's (runtime/session.zig); a client's, none. peers: *replica.Peers, - /// This wait took only a replica's post (its input, its join): the - /// pump after it reads no new time, so it moves nothing the replicas' - /// speculations stand on (a replica takes such a unit as is). + /// This wait took nothing but a replica's post, if one (its input, its + /// join): the pump after one reads no new time (Peers.heldNow). mail_only: bool = false, waited: bool = false, /// This wait's steps so far, and the input held for the next (`split`). @@ -1321,7 +1320,7 @@ const Shell = struct { const s = of(ctx); if (s.waited) { s.waited = false; - if (s.mail_only and s.peers.count() > 0 and s.core.clock.started) return s.core.clock.now_ns; + if (s.peers.heldNow(s.core, s.mail_only)) |held| return held; } return s.test_clock orelse @intCast(std.Io.Clock.awake.now(s.io).nanoseconds); } |
