diff --git a/src/threads.zig b/src/threads.zig index 46e7a07..4a976e1 100644 --- a/src/threads.zig +++ b/src/threads.zig @@ -18,16 +18,13 @@ const QueueWrap = struct { .job_pool = job_pool, }; } - fn deinit(self: *Self) void { - self.job_pool.deinit(); - self.alloc.destroy(self.queue); - } }; pub const ThreadManager = struct { threads: std.ArrayList(std.Thread), arena: std.heap.ArenaAllocator, queue: QueueWrap, + job_pool: util.JobPool, const Self = @This(); @@ -40,13 +37,13 @@ pub const ThreadManager = struct { .threads = std.ArrayList(std.Thread).init(arena_alloc), .arena = arena, .queue = try QueueWrap.init(arena_alloc, job_pool), + .job_pool = job_pool, }; return thread_mgr; } pub fn deinit(self: *Self) void { - self.threads.deinit(); - self.queue.deinit(); self.arena.deinit(); + self.job_pool.deinit(); } };