#[cfg(target_os = "macos")]
pub fn set_thread_name(name: &str) {
use std::ffi::CString;
if let Ok(cname) = CString::new(name) {
unsafe {
libc::pthread_setname_np(cname.as_ptr());
}
}
}
#[cfg(target_os = "linux")]
pub fn set_thread_name(name: &str) {
use std::ffi::CString;
if let Ok(cname) = CString::new(name) {
unsafe {
libc::pthread_setname_np(libc::pthread_self(), cname.as_ptr());
}
}
}
#[cfg(target_os = "windows")]
pub fn set_thread_name(_name: &str) {
}
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
pub fn set_thread_name(_name: &str) {
}