mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
provide thread name to OS for Solarish systems
This commit is contained in:
parent
435236b887
commit
6be2d9ae86
@ -122,8 +122,21 @@ impl Thread {
|
||||
name.as_ptr() as *mut libc::c_void);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "solaris")]
|
||||
pub fn set_name(name: &CStr) {
|
||||
weak! {
|
||||
fn pthread_setname_np(
|
||||
libc::pthread_t, *const libc::c_char
|
||||
) -> libc::c_int
|
||||
}
|
||||
|
||||
if let Some(f) = pthread_setname_np.get() {
|
||||
unsafe { f(libc::pthread_self(), name.as_ptr()); }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_env = "newlib",
|
||||
target_os = "solaris",
|
||||
target_os = "haiku",
|
||||
target_os = "l4re",
|
||||
target_os = "emscripten",
|
||||
|
Loading…
Reference in New Issue
Block a user