diff options
| author | Qwerasd <qwerasd205@users.noreply.github.com> | 2025-04-09 15:26:28 -0600 |
|---|---|---|
| committer | Qwerasd <qwerasd205@users.noreply.github.com> | 2025-06-20 15:18:41 -0600 |
| commit | 7cfc906c607d94b19613fff17bf261c36f0fca92 (patch) | |
| tree | 7cb346f6e1ff9c87c8951564934cf643265d3347 /src/termio/Thread.zig | |
| parent | 77c050c156945a8bc7f1e46f732e33e842a58fe0 (diff) | |
debug: properly set thread names on macOS
Diffstat (limited to 'src/termio/Thread.zig')
| -rw-r--r-- | src/termio/Thread.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig index d8018341d..35da3c2d2 100644 --- a/src/termio/Thread.zig +++ b/src/termio/Thread.zig @@ -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, |
