Leveraging Zig's Allocators

from blog openmymind.net, | ↗ original
Let's say we wanted to write an HTTP server library for Zig. At the core of this library, we might have a pool of threads to handle requests. Keeping things simple, it might look something like: fn run(worker: *Worker) void { while (queue.pop()) |conn| { const action = worker.route(conn.req.url); action(conn.req, conn.res) catch { //...