Skip to content

Commit

Permalink
thread set_name haiku implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jul 28, 2021
1 parent eba3228 commit 52371f4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions library/std/src/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 52371f4

Please sign in to comment.