diff options
| author | John Levon <levon@movementarian.org> | 2019-08-02 09:16:20 +0100 |
|---|---|---|
| committer | John Levon <levon@movementarian.org> | 2019-08-02 09:37:23 +0100 |
| commit | 6be2d9ae864ae2a9b7f9d68ef8c073aad2b1efdc (patch) | |
| tree | 3e9ab275dcabf4d275ba9ec9111cfcd7b60ab7cd /src/libstd/sys | |
| parent | 435236b8877cdb98c82eaebfb7887782277265c5 (diff) | |
| download | rust-6be2d9ae864ae2a9b7f9d68ef8c073aad2b1efdc.tar.gz rust-6be2d9ae864ae2a9b7f9d68ef8c073aad2b1efdc.zip | |
provide thread name to OS for Solarish systems
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index f4a1783ce89..122fc11ec27 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -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", |
