make deallocs not suck since using arena
This commit is contained in:
parent
7512246e9b
commit
d4194c501c
1 changed files with 3 additions and 6 deletions
|
@ -18,16 +18,13 @@ const QueueWrap = struct {
|
||||||
.job_pool = job_pool,
|
.job_pool = job_pool,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
fn deinit(self: *Self) void {
|
|
||||||
self.job_pool.deinit();
|
|
||||||
self.alloc.destroy(self.queue);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ThreadManager = struct {
|
pub const ThreadManager = struct {
|
||||||
threads: std.ArrayList(std.Thread),
|
threads: std.ArrayList(std.Thread),
|
||||||
arena: std.heap.ArenaAllocator,
|
arena: std.heap.ArenaAllocator,
|
||||||
queue: QueueWrap,
|
queue: QueueWrap,
|
||||||
|
job_pool: util.JobPool,
|
||||||
|
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
|
@ -40,13 +37,13 @@ pub const ThreadManager = struct {
|
||||||
.threads = std.ArrayList(std.Thread).init(arena_alloc),
|
.threads = std.ArrayList(std.Thread).init(arena_alloc),
|
||||||
.arena = arena,
|
.arena = arena,
|
||||||
.queue = try QueueWrap.init(arena_alloc, job_pool),
|
.queue = try QueueWrap.init(arena_alloc, job_pool),
|
||||||
|
.job_pool = job_pool,
|
||||||
};
|
};
|
||||||
return thread_mgr;
|
return thread_mgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *Self) void {
|
pub fn deinit(self: *Self) void {
|
||||||
self.threads.deinit();
|
|
||||||
self.queue.deinit();
|
|
||||||
self.arena.deinit();
|
self.arena.deinit();
|
||||||
|
self.job_pool.deinit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue