diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 00:49:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:21:29 -0300 |
| commit | d2a066ea4ffe4388fe0da71bd8389649ac59b73f (patch) | |
| tree | 7fd1c14031fae112711244e62631db6e8ab7ed47 /src/host_io.zig | |
| parent | 9f2d43fb16720782b0dbf2f78e3121194b4efdc2 (diff) | |
| download | pardes-d2a066ea4ffe4388fe0da71bd8389649ac59b73f.tar.gz pardes-d2a066ea4ffe4388fe0da71bd8389649ac59b73f.zip | |
host_io: the image, PDF and syntax subsystems a session draws with start and stop in one place (startWorkers, stopWorkers), where the tty's local session, the window's session and its test grid each started them and deferred their stop in eleven lines of their own
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/host_io.zig')
| -rw-r--r-- | src/host_io.zig | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig index 97e6cbbc..d6b9b72e 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -75,6 +75,27 @@ pub fn testClock() ?u64 { return if (libc.getenv("PARDES_TEST_CLOCK")) |v| (if (std.mem.span(v).len != 0) 0 else null) else null; } +/// The image, PDF and syntax subsystems a frontend's session draws with, +/// on `allocs` (pardes.memory.init); PDF pages render on lanes off the +/// loop (pdf_view.workers). `stopWorkers` is its defer. +pub fn startWorkers(io: std.Io, allocs: pardes.memory.Allocators) void { + pardes.image.start(io, allocs.image); + if (comptime pardes.pdf_enabled) { + pardes.pdf.start(allocs.pdf); + pardes.panes.Pdf.workers = io; + } + pardes.syntax.start(allocs.tree_sitter); +} + +pub fn stopWorkers() void { + pardes.image.stop(); + if (comptime pardes.pdf_enabled) { + pardes.panes.Pdf.dropKept(); + pardes.pdf.stop(); + } + pardes.syntax.stop(); +} + pub const Fallback = struct { pub const dump_path = "pardes.dump"; |
