diff options
| author | David Carlier <devnexen@gmail.com> | 2021-07-28 18:22:19 +0100 |
|---|---|---|
| committer | David Carlier <devnexen@gmail.com> | 2021-07-28 18:22:19 +0100 |
| commit | 52371f4b16c76001e054761023a6ef4e817d42ad (patch) | |
| tree | f481359d002456fb34a8b570414eae1c4bfc4bf1 | |
| parent | eba3228b2a9875d268ff3990903d04e19f6cdb0c (diff) | |
| download | rust-52371f4b16c76001e054761023a6ef4e817d42ad.tar.gz rust-52371f4b16c76001e054761023a6ef4e817d42ad.zip | |
thread set_name haiku implementation.
| -rw-r--r-- | library/std/src/sys/unix/thread.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 1488bf94841..bc61f472a2b 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -164,16 +164,23 @@ impl Thread { } } + #[cfg(target_os = "haiku")] + pub fn set_name(name: &CStr) { + unsafe { + let thread_self = libc::find_thread(ptr::null_mut()); + libc::rename_thread(thread_self, name.as_ptr()); + } + } + #[cfg(any( target_env = "newlib", - target_os = "haiku", target_os = "l4re", target_os = "emscripten", target_os = "redox", target_os = "vxworks" ))] pub fn set_name(_name: &CStr) { - // Newlib, Haiku, Emscripten, and VxWorks have no way to set a thread name. + // Newlib, Emscripten, and VxWorks have no way to set a thread name. } pub fn sleep(dur: Duration) { |
