@@ -75,7 +75,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
75
75
}
76
76
} else {
77
77
const err = std .c .pthread_setname_np (self .getHandle (), name_with_terminator .ptr );
78
- switch (err ) {
78
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
79
79
.SUCCESS = > return ,
80
80
.RANGE = > unreachable ,
81
81
else = > | e | return posix .unexpectedErrno (e ),
@@ -119,14 +119,14 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
119
119
if (self .getHandle () != std .c .pthread_self ()) return error .Unsupported ;
120
120
121
121
const err = std .c .pthread_setname_np (name_with_terminator .ptr );
122
- switch (err ) {
122
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
123
123
.SUCCESS = > return ,
124
124
else = > | e | return posix .unexpectedErrno (e ),
125
125
}
126
126
},
127
127
.netbsd , .solaris , .illumos = > if (use_pthreads ) {
128
128
const err = std .c .pthread_setname_np (self .getHandle (), name_with_terminator .ptr , null );
129
- switch (err ) {
129
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
130
130
.SUCCESS = > return ,
131
131
.INVAL = > unreachable ,
132
132
.SRCH = > unreachable ,
@@ -144,7 +144,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
144
144
},
145
145
.dragonfly = > if (use_pthreads ) {
146
146
const err = std .c .pthread_setname_np (self .getHandle (), name_with_terminator .ptr );
147
- switch (err ) {
147
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
148
148
.SUCCESS = > return ,
149
149
.INVAL = > unreachable ,
150
150
.FAULT = > unreachable ,
@@ -180,7 +180,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
180
180
}
181
181
} else {
182
182
const err = std .c .pthread_getname_np (self .getHandle (), buffer .ptr , max_name_len + 1 );
183
- switch (err ) {
183
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
184
184
.SUCCESS = > return std .mem .sliceTo (buffer , 0 ),
185
185
.RANGE = > unreachable ,
186
186
else = > | e | return posix .unexpectedErrno (e ),
@@ -219,15 +219,15 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
219
219
},
220
220
.macos , .ios , .watchos , .tvos , .visionos = > if (use_pthreads ) {
221
221
const err = std .c .pthread_getname_np (self .getHandle (), buffer .ptr , max_name_len + 1 );
222
- switch (err ) {
222
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
223
223
.SUCCESS = > return std .mem .sliceTo (buffer , 0 ),
224
224
.SRCH = > unreachable ,
225
225
else = > | e | return posix .unexpectedErrno (e ),
226
226
}
227
227
},
228
228
.netbsd , .solaris , .illumos = > if (use_pthreads ) {
229
229
const err = std .c .pthread_getname_np (self .getHandle (), buffer .ptr , max_name_len + 1 );
230
- switch (err ) {
230
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
231
231
.SUCCESS = > return std .mem .sliceTo (buffer , 0 ),
232
232
.INVAL = > unreachable ,
233
233
.SRCH = > unreachable ,
@@ -243,7 +243,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
243
243
},
244
244
.dragonfly = > if (use_pthreads ) {
245
245
const err = std .c .pthread_getname_np (self .getHandle (), buffer .ptr , max_name_len + 1 );
246
- switch (err ) {
246
+ switch (@as ( posix . E , @enumFromInt ( err )) ) {
247
247
.SUCCESS = > return std .mem .sliceTo (buffer , 0 ),
248
248
.INVAL = > unreachable ,
249
249
.FAULT = > unreachable ,
0 commit comments