summaryrefslogtreecommitdiff
path: root/dev/Inbox.zig
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Inbox.zig')
-rw-r--r--dev/Inbox.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/dev/Inbox.zig b/dev/Inbox.zig
index 234d89eb..347ad278 100644
--- a/dev/Inbox.zig
+++ b/dev/Inbox.zig
@@ -47,8 +47,12 @@ pub const Msg = union(enum) {
}
};
-pub const capacity = 512;
-pub const output_capacity = capacity - pardes.MAX_PANES;
+/// The ring's room: output up to `output_capacity` (a reader waits for
+/// more), an Adopt's shells beyond it (one note's: never lost to a flood),
+/// and each pane's end of file beyond those (lost to neither).
+pub const output_capacity = 512 - pardes.MAX_PANES;
+const adopt_capacity = output_capacity + pardes.MAX_PANES + 1;
+pub const capacity = adopt_capacity + pardes.MAX_PANES;
pub const Batch = struct {
items: [capacity + 2 * selection_pipe.Tasks.capacity + 2]Msg = undefined,
@@ -194,7 +198,7 @@ pub fn push(q: *Inbox, m: Msg) void {
return;
}
std.debug.assert(q.len < q.items.len);
- } else if (q.len >= output_capacity) {
+ } else if (q.len >= @as(usize, if (m == .adopted) adopt_capacity else output_capacity)) {
q.unlock();
m.deinit(q.gpa, q.lsp_allocator);
return;