Fire and forgotten std.Io.Future

Instead of anyerror use a defined error set.

You also don’t need to heap allocate, instead:

// not create since it doesn't heap allocate
fn init(self: *Self, io: std.Io) void {
    self.tasks = .init(io, &self.buffer);
}

// used like this:
var reaper: DetachedTaskReaper(10) = undefined;
reaper.init(io);

Initialisation is always preferable over creation as it gives control over the creation to the caller.

Lastly; the semantic of group.async (used by Select.async) mean select could deadlock, though no Io implementation currently has this behaviour. But the semantics could also change `groupAsync` vs `Group.async`

7 Likes