mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-01 01:21:22 +00:00
debug: properly set thread names on macOS
This commit is contained in:
@@ -16,6 +16,7 @@ const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
const builtin = @import("builtin");
|
||||
const xev = @import("../global.zig").xev;
|
||||
const crash = @import("../crash/main.zig");
|
||||
const internal_os = @import("../os/main.zig");
|
||||
const termio = @import("../termio.zig");
|
||||
const renderer = @import("../renderer.zig");
|
||||
const BlockingQueue = @import("../datastruct/main.zig").BlockingQueue;
|
||||
@@ -202,6 +203,13 @@ pub fn threadMain(self: *Thread, io: *termio.Termio) void {
|
||||
fn threadMain_(self: *Thread, io: *termio.Termio) !void {
|
||||
defer log.debug("IO 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(&"io".*);
|
||||
}
|
||||
|
||||
// Setup our crash metadata
|
||||
crash.sentry.thread_state = .{
|
||||
.type = .io,
|
||||
|
||||
Reference in New Issue
Block a user