fn crashHandler(userdata: ?*anyopaque) void userdata: ?*anyopaque969
970
971
972
973
974
975
976
977
978
979
980
981
982
983fn crashHandler(userdata: ?*anyopaque) void {
const ev: *Evented = @ptrCast(@alignCast(userdata));
_ = ev;
const thread = &Thread.self;
if (thread.current_context == null) std.process.abort();
if (thread.current_context == &thread.main_context) std.process.abort();
const fiber = thread.currentFiber();
@atomicStore(
Fiber.CancelStatus,
&fiber.cancel_status,
.{ .requested = true, .awaiting = .nothing },
.monotonic,
);
fiber.cancel_protection = .{ .user = .blocked, .acknowledged = true };
}