Skip to content

Commit 6cc91cb

Browse files
committed
Rename std::thread::available_onccurrency to std::thread::available_parallelism
1 parent 83f147b commit 6cc91cb

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

library/std/src/sys/hermit/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Thread {
9797
}
9898
}
9999

100-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
100+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
101101
unsupported()
102102
}
103103

library/std/src/sys/sgx/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl Thread {
137137
}
138138
}
139139

140-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
140+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
141141
unsupported()
142142
}
143143

library/std/src/sys/unix/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl Drop for Thread {
263263
}
264264
}
265265

266-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
266+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
267267
cfg_if::cfg_if! {
268268
if #[cfg(any(
269269
target_os = "android",

library/std/src/sys/unsupported/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Thread {
3131
}
3232
}
3333

34-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
34+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
3535
unsupported()
3636
}
3737

library/std/src/sys/wasi/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Thread {
6464
}
6565
}
6666

67-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
67+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
6868
unsupported()
6969
}
7070

library/std/src/sys/wasm/atomics/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Thread {
4040
pub fn join(self) {}
4141
}
4242

43-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
43+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
4444
unsupported()
4545
}
4646

library/std/src/sys/windows/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Thread {
100100
}
101101
}
102102

103-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
103+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
104104
let res = unsafe {
105105
let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed();
106106
c::GetSystemInfo(&mut sysinfo);

library/std/src/thread/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1455,12 +1455,12 @@ fn _assert_sync_and_send() {
14551455
///
14561456
/// ```
14571457
/// # #![allow(dead_code)]
1458-
/// #![feature(available_concurrency)]
1458+
/// #![feature(available_parallelism)]
14591459
/// use std::thread;
14601460
///
1461-
/// let count = thread::available_concurrency().map(|n| n.get()).unwrap_or(1);
1461+
/// let count = thread::available_parallelism().map(|n| n.get()).unwrap_or(1);
14621462
/// ```
1463-
#[unstable(feature = "available_concurrency", issue = "74479")]
1464-
pub fn available_concurrency() -> io::Result<NonZeroUsize> {
1465-
imp::available_concurrency()
1463+
#[unstable(feature = "available_parallelism", issue = "74479")]
1464+
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
1465+
imp::available_parallelism()
14661466
}

library/test/src/helpers/concurrency.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ pub fn get_concurrency() -> usize {
99
_ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", value),
1010
}
1111
} else {
12-
thread::available_concurrency().map(|n| n.get()).unwrap_or(1)
12+
thread::available_parallelism().map(|n| n.get()).unwrap_or(1)
1313
}
1414
}

library/test/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![feature(libc)]
2424
#![feature(rustc_private)]
2525
#![feature(nll)]
26-
#![feature(available_concurrency)]
26+
#![feature(available_parallelism)]
2727
#![feature(bench_black_box)]
2828
#![feature(internal_output_capture)]
2929
#![feature(panic_unwind)]

src/doc/rustc/src/tests/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ The following options affect how tests are executed.
161161

162162
Sets the number of threads to use for running tests in parallel. By default,
163163
uses the amount of concurrency available on the hardware as indicated by
164-
[`available_concurrency`].
164+
[`available_parallelism`].
165165

166166
This can also be specified with the `RUST_TEST_THREADS` environment variable.
167167

@@ -265,7 +265,7 @@ Experimental support for using custom test harnesses is available on the
265265

266266
[`--test` option]: ../command-line-arguments.md#option-test
267267
[`-Z panic-abort-tests`]: https://github.com/rust-lang/rust/issues/67650
268-
[`available_concurrency`]: ../../std/thread/fn.available_concurrency.html
268+
[`available_parallelism`]: ../../std/thread/fn.available_parallelism.html
269269
[`cargo test`]: ../../cargo/commands/cargo-test.html
270270
[`libtest`]: ../../test/index.html
271271
[`main` function]: ../../reference/crates-and-source-files.html#main-functions

0 commit comments

Comments
 (0)