debug: properly set thread names on macOS

This commit is contained in:
Qwerasd
2025-04-09 15:26:28 -06:00
parent 77c050c156
commit 7cfc906c60
6 changed files with 41 additions and 0 deletions

View File

@@ -198,6 +198,13 @@ pub fn threadMain(self: *Thread) void {
fn threadMain_(self: *Thread) !void {
defer log.debug("renderer thread exited", .{});
// Right now, on Darwin, `std.Thread.setName` can only name the current
// thread, and we have no way to get the current thread from within it,
// so instead we use this code to name the thread instead.
if (builtin.os.tag.isDarwin()) {
internal_os.macos.pthread_setname_np(&"renderer".*);
}
// Setup our crash metadata
crash.sentry.thread_state = .{
.type = .renderer,