File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -142,12 +142,16 @@ impl Thread {
142142 }
143143 }
144144
145- #[ cfg( any(
146- target_os = "freebsd" ,
147- target_os = "dragonfly" ,
148- target_os = "openbsd" ,
149- target_os = "nuttx"
150- ) ) ]
145+ #[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" ) ) ]
146+ pub fn set_name ( name : & CStr ) {
147+ unsafe {
148+ let res = libc:: pthread_setname_np ( libc:: pthread_self ( ) , name. as_ptr ( ) ) ;
149+ // We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
150+ debug_assert_eq ! ( res, 0 ) ;
151+ }
152+ }
153+
154+ #[ cfg( any( target_os = "openbsd" , target_os = "nuttx" ) ) ]
151155 pub fn set_name ( name : & CStr ) {
152156 unsafe {
153157 libc:: pthread_set_name_np ( libc:: pthread_self ( ) , name. as_ptr ( ) ) ;
You can’t perform that action at this time.
0 commit comments