| ... | @@ -179,10 +179,6 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co | ... | @@ -179,10 +179,6 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 179 | else => |e| return os.unexpectedErrno(e), | 179 | else => |e| return os.unexpectedErrno(e), |
| 180 | } | 180 | } |
| 181 | } else { | 181 | } else { |
| 182 | if (target.abi.isMusl()) { | | |
| 183 | // musl doesn't provide pthread_getname_np and there's no way to retrieve the thread id of an arbitrary thread. | | |
| 184 | return error.Unsupported; | | |
| 185 | } | | |
| 186 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 182 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 187 | switch (err) { | 183 | switch (err) { |
| 188 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 184 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| ... | @@ -1133,16 +1129,7 @@ test "setName, getName" { | ... | @@ -1133,16 +1129,7 @@ test "setName, getName" { |
| 1133 | error.Unsupported => return error.SkipZigTest, | 1129 | error.Unsupported => return error.SkipZigTest, |
| 1134 | else => return err, | 1130 | else => return err, |
| 1135 | }, | 1131 | }, |
| 1136 | else => |tag| if (tag == .linux and use_pthreads and comptime target.abi.isMusl()) { | 1132 | else => try testThreadName(&thread), |
| 1137 | try thread.setName("foobar"); | | |
| 1138 | | | |
| 1139 | var name_buffer: [max_name_len:0]u8 = undefined; | | |
| 1140 | const res = thread.getName(&name_buffer); | | |
| 1141 | | | |
| 1142 | try std.testing.expectError(error.Unsupported, res); | | |
| 1143 | } else { | | |
| 1144 | try testThreadName(&thread); | | |
| 1145 | }, | | |
| 1146 | } | 1133 | } |
| 1147 | | 1134 | |
| 1148 | context.thread_done_event.set(); | 1135 | context.thread_done_event.set(); |