mirror of
https://github.com/rdmsr/zag.git
synced 2026-11-01 23:58:21 +00:00
ps+ke: add thread reaping
This commit is contained in:
@@ -150,8 +150,7 @@ fn particle(param: ?*anyopaque) void {
|
||||
data.vel_y += @divTrunc(int_to_fp(10) * delay, 1000);
|
||||
}
|
||||
|
||||
// Now block.
|
||||
ke.sched.block();
|
||||
ps.thread.exit();
|
||||
}
|
||||
|
||||
fn spawn_particle(arg: ?*anyopaque) void {
|
||||
@@ -214,7 +213,7 @@ fn explodeable(_: ?*anyopaque) void {
|
||||
spawn_particle(param);
|
||||
}
|
||||
|
||||
ke.sched.block();
|
||||
ps.thread.exit();
|
||||
}
|
||||
|
||||
pub fn start(param: ?*anyopaque) void {
|
||||
@@ -239,6 +238,8 @@ pub fn start(param: ?*anyopaque) void {
|
||||
spawn_explodeable();
|
||||
}
|
||||
|
||||
std.log.info("async: {}, sync: {}, usable memory: {} KiB", .{ mm.private.tlb.async_shootdowns.load(.monotonic), mm.private.tlb.sync_shootdowns.load(.monotonic), mm.private.phys.usable_memory.load(.monotonic) / 1024 });
|
||||
|
||||
perform_delay(2000);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,10 +21,10 @@ pub fn init(boot_info: *pl.BootInfo) void {
|
||||
exp.console.init();
|
||||
|
||||
if (boot_info.framebuffer != null) {
|
||||
fbconsole.init(boot_info);
|
||||
// fbconsole.init(boot_info);
|
||||
|
||||
// const t = ps.thread.create_kernel(ke.Thread.Priority.default, ex.fireworks.start, boot_info) catch @panic("oom");
|
||||
// ke.sched.enqueue(&t.kern);
|
||||
const t = ps.thread.create_kernel(ke.Thread.Priority.default, ex.fireworks.start, boot_info) catch @panic("oom");
|
||||
ke.sched.enqueue(&t.kern);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
@@ -38,8 +38,8 @@ pub const WorkItem = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub fn init(priority: Priority, func: *const fn (arg: ?*anyopaque) void, arg: ?*anyopaque) WorkItem {
|
||||
return .{
|
||||
pub fn init(self: *WorkItem, priority: Priority, func: *const fn (arg: ?*anyopaque) void, arg: ?*anyopaque) void {
|
||||
self.* = .{
|
||||
.func = func,
|
||||
.arg = arg,
|
||||
.link = undefined,
|
||||
|
||||
Reference in New Issue
Block a user