summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/Inbox.zig8
-rw-r--r--dev/gui/gui.zig2
-rw-r--r--dev/tui/tui.zig2
3 files changed, 8 insertions, 4 deletions
diff --git a/dev/Inbox.zig b/dev/Inbox.zig
index d733b971..1df516cb 100644
--- a/dev/Inbox.zig
+++ b/dev/Inbox.zig
@@ -118,7 +118,9 @@ pub fn acceptReader(q: *Inbox, pane: pardes.Pane.Id, gen: u32) void {
/// One of `pane`'s reads applied, or dropped unapplied.
pub fn applied(q: *Inbox, pane: pardes.Pane.Id) void {
const n = &q.unapplied[pane.index()];
- if (n.load(.acquire) > 0) _ = n.fetchSub(1, .acq_rel);
+ if (n.load(.acquire) == 0) return;
+ _ = n.fetchSub(1, .acq_rel);
+ pardes.turn.outputApplied();
}
pub fn cancelReader(q: *Inbox, pane: pardes.Pane.Id, gen: u32) void {
@@ -316,8 +318,10 @@ fn readPty(q: *Inbox, pty: std.Io.File, pane: pardes.Pane.Id, gen: u32) void {
},
};
if (n == 0) continue;
- // Counted at once: out of the pty, the poll no longer sees it.
+ // Counted at once: out of the pty, the poll no longer sees it,
+ // nor a write after it (Turn.awaitOutput).
_ = q.unapplied[pane.index()].fetchAdd(1, .acq_rel);
+ _ = pardes.turn.reads.fetchAdd(1, .acq_rel);
const bytes = q.gpa.dupe(u8, buf[0..n]) catch |err| {
q.applied(pane);
failure = err;
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig
index 3193d966..b00073fa 100644
--- a/dev/gui/gui.zig
+++ b/dev/gui/gui.zig
@@ -2696,7 +2696,7 @@ fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void {
s.held = null;
if (held) |h| sev = h;
// The wait is the 9P connections' turn with the core.
- pardes.turn.rest();
+ pardes.turn.listen();
const got = held != null or c.SDL_WaitEventTimeout(&sev, ms);
pardes.turn.wake();
// A virtual clock: while a render-time animation moves, each loop
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig
index 5d75722f..ec5a3309 100644
--- a/dev/tui/tui.zig
+++ b/dev/tui/tui.zig
@@ -1494,7 +1494,7 @@ const Shell = struct {
s.wake_to = s.core.nextWake() orelse if (s.moving()) s.core.clock.now_ns + pardes.frame_ns else 0;
requestWake(s.io, wait);
}
- pardes.turn.rest();
+ pardes.turn.listen();
const got = s.loop.nextEvent() catch {
pardes.turn.wake();
if (s.client) |c| c.link.quit = true;