summaryrefslogtreecommitdiff
path: root/dev/Inbox.zig
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Inbox.zig')
-rw-r--r--dev/Inbox.zig8
1 files changed, 6 insertions, 2 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;