diff options
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"; |
