I’m working my way through ziglings and found it mysterious why it doesn’t defer cancel std.Io.Groups:
pub fn main(init: std.process.Init) !void {
const io = init.io;
var group: std.Io.Group = .init;
// I would expect
// defer _ = group.cancel(io);
// here.
// Spawn 3 tasks in any order. Each sleeps for (id * 1) seconds
// before printing, so the output order is deterministic.
group.async(io, doWork, .{ io, 1 });
group.async(io, doWork, .{ io, 3 });
group.async(io, doWork, .{ io, 2 });
...
}
Am I missing something here?