scheduler: Add recancel and checkCancel to help manage cancellation state

This commit is contained in:
2026-06-04 17:36:01 +02:00
parent b57cb8e87b
commit a01858aede
+14
View File
@@ -391,3 +391,17 @@ pub fn cancel(self: *Scheduler, id: TaskID) !void {
child.cancel = true; child.cancel = true;
} }
pub fn checkCancel(self: *Scheduler) !void {
const task = self.findTaskByID(self.current_id.?).?;
if (!task.cancel)
return;
task.cancel = false;
return error.Canceled;
}
pub fn recancel(self: *Scheduler) void {
const task = self.findTaskByID(self.current_id.?).?;
task.cancel = true;
}