| ... | ... | @@ -63,11 +63,8 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 63 | 63 | .linux => if (use_pthreads) { |
| 64 | 64 | if (self.getHandle() == std.c.pthread_self()) { |
| 65 | 65 | // Set the name of the calling thread (no thread id required). |
| 66 | | const err = try posix.prctl(.SET_NAME, .{@intFromPtr(name_with_terminator.ptr)}); |
| 67 | | switch (@as(posix.E, @enumFromInt(err))) { |
| 68 | | .SUCCESS => return, |
| 69 | | else => |e| return posix.unexpectedErrno(e), |
| 70 | | } |
| 66 | assert(try posix.prctl(.SET_NAME, .{@intFromPtr(name_with_terminator.ptr)}) == 0); |
| 67 | return; |
| 71 | 68 | } else { |
| 72 | 69 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); |
| 73 | 70 | switch (@as(posix.E, @enumFromInt(err))) { |
| ... | ... | @@ -167,11 +164,8 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 167 | 164 | .linux => if (use_pthreads) { |
| 168 | 165 | if (self.getHandle() == std.c.pthread_self()) { |
| 169 | 166 | // Get the name of the calling thread (no thread id required). |
| 170 | | const err = try posix.prctl(.GET_NAME, .{@intFromPtr(buffer.ptr)}); |
| 171 | | switch (@as(posix.E, @enumFromInt(err))) { |
| 172 | | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 173 | | else => |e| return posix.unexpectedErrno(e), |
| 174 | | } |
| 167 | assert(try posix.prctl(.GET_NAME, .{@intFromPtr(buffer.ptr)}) == 0); |
| 168 | return std.mem.sliceTo(buffer, 0); |
| 175 | 169 | } else { |
| 176 | 170 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 177 | 171 | switch (@as(posix.E, @enumFromInt(err))) { |