Skip to content

Commit 52371f4

Browse files
committed
thread set_name haiku implementation.
1 parent eba3228 commit 52371f4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

library/std/src/sys/unix/thread.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,23 @@ impl Thread {
164164
}
165165
}
166166

167+
#[cfg(target_os = "haiku")]
168+
pub fn set_name(name: &CStr) {
169+
unsafe {
170+
let thread_self = libc::find_thread(ptr::null_mut());
171+
libc::rename_thread(thread_self, name.as_ptr());
172+
}
173+
}
174+
167175
#[cfg(any(
168176
target_env = "newlib",
169-
target_os = "haiku",
170177
target_os = "l4re",
171178
target_os = "emscripten",
172179
target_os = "redox",
173180
target_os = "vxworks"
174181
))]
175182
pub fn set_name(_name: &CStr) {
176-
// Newlib, Haiku, Emscripten, and VxWorks have no way to set a thread name.
183+
// Newlib, Emscripten, and VxWorks have no way to set a thread name.
177184
}
178185

179186
pub fn sleep(dur: Duration) {

0 commit comments

Comments
 (0)