We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b6ed3b commit 5d4048bCopy full SHA for 5d4048b
library/std/src/sys/unix/thread.rs
@@ -338,8 +338,17 @@ pub fn available_concurrency() -> io::Result<NonZeroUsize> {
338
}
339
340
Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) })
341
+ } else if #[cfg(target_os = "haiku")] {
342
+ let mut sinfo: libc::system_info = crate::mem::zeroed();
343
+ let res = libc::get_system_info(&mut sinfo);
344
+
345
+ if res != libc::B_OK {
346
+ return Err(io::Error::last_os_error());
347
+ }
348
349
+ Ok(unsafe { NonZeroUsize::new_unchecked(sinfo.cpu_count as usize) })
350
} else {
- // FIXME: implement on vxWorks, Redox, Haiku, l4re
351
+ // FIXME: implement on vxWorks, Redox, l4re
352
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Getting the number of hardware threads is not supported on the target platform"))
353
354
0 commit comments