From cb2f97a28fabc29b6fc03a67f5712fc1c83ab3c6 Mon Sep 17 00:00:00 2001 From: jaina heartles Date: Thu, 13 Oct 2022 21:05:52 -0700 Subject: [PATCH] Add multithreading --- src/main/main.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/main.zig b/src/main/main.zig index a82713b..f3c9728 100644 --- a/src/main/main.zig +++ b/src/main/main.zig @@ -104,5 +104,9 @@ pub fn main() !void { defer srv.deinit(); try srv.listen(std.net.Address.parseIp("0.0.0.0", 8080) catch unreachable); + var i: usize = 0; + while (i < cfg.worker_threads - 1) : (i += 1) { + _ = try std.Thread.spawn(.{}, thread_main, .{ &api_src, &srv }); + } thread_main(&api_src, &srv); }