1
Fork 0

add support of available_parallelism for target hermit

On RustyHermit, the function `get_processor_count` returns the
number of activated processors.
This commit is contained in:
Stefan Lankes 2023-07-03 07:21:54 +02:00
parent 910be1b3e8
commit 5842a3fe08

View file

@ -1,6 +1,5 @@
#![allow(dead_code)] #![allow(dead_code)]
use super::unsupported;
use crate::ffi::CStr; use crate::ffi::CStr;
use crate::io; use crate::io;
use crate::mem; use crate::mem;
@ -99,7 +98,7 @@ impl Thread {
} }
pub fn available_parallelism() -> io::Result<NonZeroUsize> { pub fn available_parallelism() -> io::Result<NonZeroUsize> {
unsupported() unsafe { Ok(NonZeroUsize::new_unchecked(abi::get_processor_count())) }
} }
pub mod guard { pub mod guard {