Skip to content

Commit

Permalink
fix(fiber): Main fiber can't be cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed Jul 3, 2024
1 parent ead215b commit 11ca2d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/builtin/fiber.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ pub fn over(ctx: *NativeCtx) c_int {
pub fn cancel(ctx: *NativeCtx) c_int {
const self = ObjFiber.cast(ctx.vm.peek(0).obj()).?;

// Main fiber can't be cancelled
if (self.fiber.parent_fiber == null) {
return 0;
}

self.fiber.status = .Over;

return 0;
Expand Down

0 comments on commit 11ca2d5

Please sign in to comment.