mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
![]() available_parallelism: Gracefully handle zero value cfs_period_us There seem to be some scenarios where the cgroup cpu quota field `cpu.cfs_period_us` can contain `0`. This field is used to determine the "amount" of parallelism suggested by the function `std:🧵:available_parallelism` A zero value of this field cause a panic when `available_parallelism()` is invoked. This issue was detected by the call from binaries built by `cargo test`. I really don't feel like `0` is a good value for `cpu.cfs_period_us`, but I also don't think applications should panic if this value is seen. This panic started happening with rust 1.64.0. This case is gracefully handled by other projects which read this information: [num_cpus]( |
||
---|---|---|
.. | ||
common | ||
hermit | ||
itron | ||
sgx | ||
solid | ||
unix | ||
unsupported | ||
wasi | ||
wasm | ||
windows | ||
mod.rs |