Skip to content

Commit 666d9e2

Browse files
authored
profiler: Fix pthread_getname_np not available on musl (#110)
Signed-off-by: Xuanwo <[email protected]>
1 parent ddb30fc commit 666d9e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/profiler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ fn write_thread_name_fallback(current_thread: libc::pthread_t, name: &mut [libc:
181181
}
182182
}
183183

184-
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
184+
#[cfg(not(all(any(target_os = "linux", target_os = "macos"), target_env = "gnu")))]
185185
fn write_thread_name(current_thread: libc::pthread_t, name: &mut [libc::c_char]) {
186186
write_thread_name_fallback(current_thread, name);
187187
}
188188

189-
#[cfg(any(target_os = "linux", target_os = "macos"))]
189+
#[cfg(all(any(target_os = "linux", target_os = "macos"), target_env = "gnu"))]
190190
fn write_thread_name(current_thread: libc::pthread_t, name: &mut [libc::c_char]) {
191191
let name_ptr = name as *mut [libc::c_char] as *mut libc::c_char;
192192
let ret = unsafe { libc::pthread_getname_np(current_thread, name_ptr, MAX_THREAD_NAME) };

0 commit comments

Comments
 (0)