renderer/termio attach thread local state for crash capture

This commit is contained in:
Mitchell Hashimoto
2024-09-01 10:59:19 -07:00
parent f0916d58e8
commit 8f477b00da
3 changed files with 19 additions and 10 deletions

View File

@@ -15,6 +15,7 @@ const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;
const builtin = @import("builtin");
const xev = @import("xev");
const crash = @import("../crash/main.zig");
const termio = @import("../termio.zig");
const BlockingQueue = @import("../blocking_queue.zig").BlockingQueue;
@@ -200,6 +201,12 @@ pub fn threadMain(self: *Thread, io: *termio.Termio) void {
fn threadMain_(self: *Thread, io: *termio.Termio) !void {
defer log.debug("IO thread exited", .{});
// Setup our crash metadata
crash.sentry.thread_state = .{
.surface = io.surface_mailbox.surface,
};
defer crash.sentry.thread_state = null;
// Get the mailbox. This must be an SPSC mailbox for threading.
const mailbox = switch (io.mailbox) {
.spsc => |*v| v,