ke: add continuations

This commit is contained in:
Loïc Grégoire
2026-08-29 20:03:22 -04:00
parent d06351f31c
commit 8226a205a0
20 changed files with 735 additions and 194 deletions
+2 -2
View File
@@ -126,8 +126,8 @@ pub fn init() void {
const td = ps.thread.create_kernel(
.Default,
worker,
null,
.{ .func = worker, .arg = null },
true,
) catch @panic("handle me");
ke.sched.enqueue(&td.kern);
}
+2 -1
View File
@@ -26,7 +26,8 @@ pub fn init() void {
if (rtl.cmdline.get_string(cline, "test")) |tst| {
// Run a test if specified.
if (r.tests.tests.get(tst)) |func| {
const t = ps.thread.create_kernel(.Default, func, r.boot_info) catch @panic("oom");
const t = ps.thread.create_kernel(.Default, .{ .func = func, .arg = r.boot_info }, true) catch
@panic("oom");
ke.sched.enqueue(&t.kern);
} else {
std.log.info("invalid test: \"{s}\"", .{tst});
+12 -10
View File
@@ -124,14 +124,15 @@ const Pool = struct {
var td = try ps.thread.create_kernel(
WorkItem.Priority.to_sched_prio(self.prio),
work_loop,
@ptrFromInt(ctx.value),
.{ .func = work_loop, .arg = @ptrFromInt(ctx.value) },
true,
);
td.kern.nice = -ke.Priority.nice_max;
if (cpu) |c| {
ke.sched.pin_on(&td.kern, c);
if (cpu != null) {
td.kern.last_cpu = cpu;
td.kern.pinned = true;
}
ke.sched.enqueue(&td.kern);
@@ -176,12 +177,13 @@ const Pool = struct {
var td = try ps.thread.create_kernel(
WorkItem.Priority.to_sched_prio(self.prio),
work_loop,
@ptrFromInt(ctx.value),
.{ .func = work_loop, .arg = @ptrFromInt(ctx.value) },
true,
);
if (cpu) |c| {
ke.sched.pin_on(&td.kern, c);
if (cpu != null) {
td.kern.last_cpu = cpu;
td.kern.pinned = true;
}
ke.sched.enqueue(&td.kern);
@@ -313,8 +315,8 @@ pub fn init() !void {
var td = ps.thread.create_kernel(
.Default,
pool_manager,
null,
.{ .func = pool_manager, .arg = null },
true,
) catch @panic("Failed to create pool manager");
ke.sched.enqueue(&td.kern);