Rollup merge of #144188 - joshtriplett:available-parallelism, r=Mark-Simulacrum

`available_parallelism`: Add documentation for why we don't look at `ulimit`
This commit is contained in:
Stuart Cook 2025-08-04 11:24:36 +10:00 committed by GitHub
commit e65201ccb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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