fix build.
This commit is contained in:
parent
4b84df9ea3
commit
1871ea5710
@ -355,8 +355,6 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
|
|||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "solaris",
|
|
||||||
target_os = "illumos",
|
|
||||||
target_os = "aix",
|
target_os = "aix",
|
||||||
))] {
|
))] {
|
||||||
#[allow(unused_assignments)]
|
#[allow(unused_assignments)]
|
||||||
@ -485,10 +483,10 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
|
|||||||
}
|
}
|
||||||
} else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
|
} else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
|
||||||
let mut cpus = 0u32;
|
let mut cpus = 0u32;
|
||||||
if unsafe { libc::pset_info(libc::PS_MYID, core::ptr::null_mut(), &mut cpus, core::ptr::null_mut()) } == 0 {
|
if unsafe { libc::pset_info(libc::PS_MYID, core::ptr::null_mut(), &mut cpus, core::ptr::null_mut()) } != 0 {
|
||||||
NonZero::new(cpus as usize)
|
return Err(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform"));
|
||||||
.ok_or(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform"))
|
|
||||||
}
|
}
|
||||||
|
Ok(unsafe { NonZero::new_unchecked(cpus as usize) })
|
||||||
} else if #[cfg(target_os = "haiku")] {
|
} else if #[cfg(target_os = "haiku")] {
|
||||||
// system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus`
|
// system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus`
|
||||||
// `get_system_info` calls then `smp_get_num_cpus`
|
// `get_system_info` calls then `smp_get_num_cpus`
|
||||||
|
Loading…
Reference in New Issue
Block a user