Skip to content

Commit 887ffc6

Browse files
committed
tweak comments
1 parent be6f27b commit 887ffc6

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/tools/miri/tests/pass-dep/shims/pthreads.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::ffi::CString;
55
use std::thread;
66

77
fn main() {
8+
test_named_thread_truncation();
9+
810
#[cfg(not(target_os = "freebsd"))]
911
test_mutex_libc_init_recursive();
1012
#[cfg(not(target_os = "freebsd"))]
@@ -14,8 +16,6 @@ fn main() {
1416
#[cfg(not(target_os = "freebsd"))]
1517
test_rwlock_libc_static_initializer();
1618

17-
test_named_thread_truncation();
18-
1919
#[cfg(target_os = "linux")]
2020
test_mutex_libc_static_initializer_recursive();
2121
}
@@ -150,12 +150,10 @@ fn test_named_thread_truncation() {
150150
return unsafe { libc::pthread_setname_np(libc::pthread_self(), name.as_ptr().cast()) };
151151
#[cfg(target_os = "freebsd")]
152152
unsafe {
153-
// pthread_set_name_np does not return anything only it can fail if the
154-
// thread id is invalid
155-
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast())
153+
// pthread_set_name_np does not return anything
154+
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast());
155+
return 0;
156156
};
157-
#[cfg(target_os = "freebsd")]
158-
return 0;
159157
#[cfg(target_os = "macos")]
160158
return unsafe { libc::pthread_setname_np(name.as_ptr().cast()) };
161159
}
@@ -172,8 +170,6 @@ fn test_named_thread_truncation() {
172170
};
173171
#[cfg(target_os = "freebsd")]
174172
unsafe {
175-
// pthread_get_name_np does not return anything only it can fail if the
176-
// thread id is invalid
177173
libc::pthread_get_name_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
178174
};
179175
let cstr = CStr::from_bytes_until_nul(&buf).unwrap();

0 commit comments

Comments
 (0)