about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-07-19 11:17:38 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-07-19 11:17:38 -0700
commit41199f39d89135408763eee492fd2a5270828030 (patch)
tree4d9f24b543395fb0fdef752ef8af04bed0e430d5
parentf63685ddf3d3c92a61158cd55d44bde17c2b024f (diff)
downloadrust-41199f39d89135408763eee492fd2a5270828030.tar.gz
rust-41199f39d89135408763eee492fd2a5270828030.zip
`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 6075173db47..c80ea9cf4f0 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -2012,6 +2012,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