Rename std:🧵:available_onccurrency
to std:🧵:available_parallelism
This commit is contained in:
parent
83f147b3ba
commit
6cc91cb3d8
@ -97,7 +97,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
unsupported()
|
unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
unsupported()
|
unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ impl Drop for Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(
|
if #[cfg(any(
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
|
@ -31,7 +31,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
unsupported()
|
unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
unsupported()
|
unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ impl Thread {
|
|||||||
pub fn join(self) {}
|
pub fn join(self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
unsupported()
|
unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
let res = unsafe {
|
let res = unsafe {
|
||||||
let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed();
|
let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed();
|
||||||
c::GetSystemInfo(&mut sysinfo);
|
c::GetSystemInfo(&mut sysinfo);
|
||||||
|
@ -1455,12 +1455,12 @@ fn _assert_sync_and_send() {
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # #![allow(dead_code)]
|
/// # #![allow(dead_code)]
|
||||||
/// #![feature(available_concurrency)]
|
/// #![feature(available_parallelism)]
|
||||||
/// use std::thread;
|
/// use std::thread;
|
||||||
///
|
///
|
||||||
/// let count = thread::available_concurrency().map(|n| n.get()).unwrap_or(1);
|
/// let count = thread::available_parallelism().map(|n| n.get()).unwrap_or(1);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "available_concurrency", issue = "74479")]
|
#[unstable(feature = "available_parallelism", issue = "74479")]
|
||||||
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
|
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
|
||||||
imp::available_concurrency()
|
imp::available_parallelism()
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ pub fn get_concurrency() -> usize {
|
|||||||
_ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", value),
|
_ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", value),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
thread::available_concurrency().map(|n| n.get()).unwrap_or(1)
|
thread::available_parallelism().map(|n| n.get()).unwrap_or(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(available_concurrency)]
|
#![feature(available_parallelism)]
|
||||||
#![feature(bench_black_box)]
|
#![feature(bench_black_box)]
|
||||||
#![feature(internal_output_capture)]
|
#![feature(internal_output_capture)]
|
||||||
#![feature(panic_unwind)]
|
#![feature(panic_unwind)]
|
||||||
|
@ -161,7 +161,7 @@ The following options affect how tests are executed.
|
|||||||
|
|
||||||
Sets the number of threads to use for running tests in parallel. By default,
|
Sets the number of threads to use for running tests in parallel. By default,
|
||||||
uses the amount of concurrency available on the hardware as indicated by
|
uses the amount of concurrency available on the hardware as indicated by
|
||||||
[`available_concurrency`].
|
[`available_parallelism`].
|
||||||
|
|
||||||
This can also be specified with the `RUST_TEST_THREADS` environment variable.
|
This can also be specified with the `RUST_TEST_THREADS` environment variable.
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ Experimental support for using custom test harnesses is available on the
|
|||||||
|
|
||||||
[`--test` option]: ../command-line-arguments.md#option-test
|
[`--test` option]: ../command-line-arguments.md#option-test
|
||||||
[`-Z panic-abort-tests`]: https://github.com/rust-lang/rust/issues/67650
|
[`-Z panic-abort-tests`]: https://github.com/rust-lang/rust/issues/67650
|
||||||
[`available_concurrency`]: ../../std/thread/fn.available_concurrency.html
|
[`available_parallelism`]: ../../std/thread/fn.available_parallelism.html
|
||||||
[`cargo test`]: ../../cargo/commands/cargo-test.html
|
[`cargo test`]: ../../cargo/commands/cargo-test.html
|
||||||
[`libtest`]: ../../test/index.html
|
[`libtest`]: ../../test/index.html
|
||||||
[`main` function]: ../../reference/crates-and-source-files.html#main-functions
|
[`main` function]: ../../reference/crates-and-source-files.html#main-functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user