Skip to content

Commit

Permalink
tweak comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 12, 2023
1 parent bc154db commit e0fef82
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/pass-dep/shims/pthreads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use std::ffi::CString;
use std::thread;

fn main() {
test_named_thread_truncation();

#[cfg(not(target_os = "freebsd"))]
test_mutex_libc_init_recursive();
#[cfg(not(target_os = "freebsd"))]
Expand All @@ -14,8 +16,6 @@ fn main() {
#[cfg(not(target_os = "freebsd"))]
test_rwlock_libc_static_initializer();

test_named_thread_truncation();

#[cfg(target_os = "linux")]
test_mutex_libc_static_initializer_recursive();
}
Expand Down Expand Up @@ -150,12 +150,10 @@ fn test_named_thread_truncation() {
return unsafe { libc::pthread_setname_np(libc::pthread_self(), name.as_ptr().cast()) };
#[cfg(target_os = "freebsd")]
unsafe {
// pthread_set_name_np does not return anything only it can fail if the
// thread id is invalid
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast())
// pthread_set_name_np does not return anything
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast());
return 0;
};
#[cfg(target_os = "freebsd")]
return 0;
#[cfg(target_os = "macos")]
return unsafe { libc::pthread_setname_np(name.as_ptr().cast()) };
}
Expand All @@ -172,8 +170,6 @@ fn test_named_thread_truncation() {
};
#[cfg(target_os = "freebsd")]
unsafe {
// pthread_get_name_np does not return anything only it can fail if the
// thread id is invalid
libc::pthread_get_name_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
};
let cstr = CStr::from_bytes_until_nul(&buf).unwrap();
Expand Down

0 comments on commit e0fef82

Please sign in to comment.