about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-04 11:24:36 +1000
committerGitHub <noreply@github.com>2025-08-04 11:24:36 +1000
commite65201ccb88c5abee4cd02fa619620fc63b5325f (patch)
tree631a23cbbd172f2820bb98146fed9e4eb58c1576
parent625b180035aa0f7a5796c1ea133f81d9f20b81ff (diff)
parent41199f39d89135408763eee492fd2a5270828030 (diff)
downloadrust-e65201ccb88c5abee4cd02fa619620fc63b5325f.tar.gz
rust-e65201ccb88c5abee4cd02fa619620fc63b5325f.zip
Rollup merge of #144188 - joshtriplett:available-parallelism, r=Mark-Simulacrum
`available_parallelism`: Add documentation for why we don't look at `ulimit`
-rw-r--r--library/std/src/thread/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index dff981c900c..8d3ab82ace1 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -2018,6 +2018,9 @@ fn _assert_sync_and_send() {
 ///   which may take time on systems with large numbers of mountpoints.
 ///   (This does not apply to cgroup v2, or to processes not in a
 ///   cgroup.)
+/// - It does not attempt to take `ulimit` into account. If there is a limit set on the number of
+///   threads, `available_parallelism` cannot know how much of that limit a Rust program should
+///   take, or know in a reliable and race-free way how much of that limit is already taken.
 ///
 /// On all targets:
 /// - It may overcount the amount of parallelism available when running in a VM