fibers: Scheduler.deinit + struct-literal init cleanup

Scheduler.deinit closes the bounded leaks B1 documented: it reaps any leftover
ready fibers, frees every heap Task from go (now tracked via a task_allocs
field), frees the timers/io_waiters/task_allocs List backings, and closes the
lazily-opened kqueue fd. Terminal + idempotent; the per-spawn/go closure env
remains unfreeable (language limitation). Locked by
examples/concurrency/1820-concurrency-fiber-scheduler-deinit.sx, which exercises
every freed resource under a tracking GPA (freed by deinit: 5, kq reset to -1).

Also converts plain-struct '= ---'+field-assign init to '.{ ... }' literal init
where '---' carries no meaning: Scheduler.init, Dock.make, and the fiber
examples 1811/1813/1814/1816 (partial literals zero-fill the index-filled array
fields). Unions, '---'-feature tests, the 0154 regression, documented
generic-pack gaps, and loop/conditional inits are intentionally left on '---'.
This commit is contained in:
agra
2026-06-22 09:45:33 +03:00
parent 1e0015d6b4
commit 55ed9a248e
12 changed files with 299 additions and 53 deletions

View File

@@ -472,20 +472,20 @@ Dock :: struct {
on_dock: ?Closure(i64, DockZone);
make :: (interaction: *DockInteraction, delta_time: *f32) -> Dock {
d : Dock = ---;
d.children = List(ViewChild).{};
d.alignments = List(Alignment).{};
d.interaction = interaction;
d.delta_time = delta_time;
d.background = null;
d.corner_radius = 0.0;
d.hint_size = 40.0;
d.hint_color = Color.rgba(77, 153, 255, 153);
d.hint_active_color = Color.rgba(77, 153, 255, 230);
d.preview_color = Color.rgba(77, 153, 255, 64);
d.enable_corners = true;
d.on_dock = null;
d
Dock.{
children = List(ViewChild).{},
alignments = List(Alignment).{},
interaction = interaction,
delta_time = delta_time,
background = null,
corner_radius = 0.0,
hint_size = 40.0,
hint_color = Color.rgba(77, 153, 255, 153),
hint_active_color = Color.rgba(77, 153, 255, 230),
preview_color = Color.rgba(77, 153, 255, 64),
enable_corners = true,
on_dock = null
}
}
add_panel :: (self: *Dock, panel: DockPanel) {