Add multithreading

This commit is contained in:
jaina heartles 2022-10-13 21:05:52 -07:00
parent 0ce315368a
commit cb2f97a28f
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}