Use Unsupported on platforms where available_concurrency is not implemented.
This commit is contained in:
parent
05ec710c80
commit
888418a079
6 changed files with 9 additions and 21 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use super::unsupported;
|
||||
use crate::ffi::CStr;
|
||||
use crate::io;
|
||||
use crate::mem;
|
||||
|
|
@ -97,10 +98,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
||||
Err(io::Error::new_const(
|
||||
io::ErrorKind::NotFound,
|
||||
&"The number of hardware threads is not known for the target platform",
|
||||
))
|
||||
unsupported()
|
||||
}
|
||||
|
||||
pub mod guard {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#![cfg_attr(test, allow(dead_code))] // why is this necessary?
|
||||
use super::unsupported;
|
||||
use crate::ffi::CStr;
|
||||
use crate::io;
|
||||
use crate::num::NonZeroUsize;
|
||||
|
|
@ -137,10 +138,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
||||
Err(io::Error::new_const(
|
||||
io::ErrorKind::NotFound,
|
||||
&"The number of hardware threads is not known for the target platform",
|
||||
))
|
||||
unsupported()
|
||||
}
|
||||
|
||||
pub mod guard {
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
|||
Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) })
|
||||
} else {
|
||||
// FIXME: implement on vxWorks, Redox, Haiku, l4re
|
||||
Err(io::Error::new_const(io::ErrorKind::NotFound, &"The number of hardware threads is not known for the target platform"))
|
||||
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Getting the number of hardware threads is not supported on the target platform"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
||||
Err(io::Error::new_const(
|
||||
io::ErrorKind::NotFound,
|
||||
&"The number of hardware threads is not known for the target platform",
|
||||
))
|
||||
unsupported()
|
||||
}
|
||||
|
||||
pub mod guard {
|
||||
|
|
|
|||
|
|
@ -65,10 +65,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
||||
Err(io::Error::new_const(
|
||||
io::ErrorKind::NotFound,
|
||||
&"The number of hardware threads is not known for the target platform",
|
||||
))
|
||||
unsupported()
|
||||
}
|
||||
|
||||
pub mod guard {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use super::unsupported;
|
||||
use crate::ffi::CStr;
|
||||
use crate::io;
|
||||
use crate::num::NonZeroUsize;
|
||||
|
|
@ -41,10 +42,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
||||
Err(io::Error::new_const(
|
||||
io::ErrorKind::NotFound,
|
||||
&"The number of hardware threads is not known for the target platform",
|
||||
))
|
||||
unsupported()
|
||||
}
|
||||
|
||||
pub mod guard {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue