about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-10-23 14:58:43 +0200
committerGitHub <noreply@github.com>2021-10-23 14:58:43 +0200
commit1680359dad8f412a145c565ac84ea3711d5f97a0 (patch)
tree16baed491843625ea1482a9da2cd0b419342fe54
parent74a0c492c190185552837e3d94baef4dbdacd230 (diff)
parentfd25491807f1a2d8314dca14dfb01f224d6df093 (diff)
downloadrust-1680359dad8f412a145c565ac84ea3711d5f97a0.tar.gz
rust-1680359dad8f412a145c565ac84ea3711d5f97a0.zip
Rollup merge of #90198 - the8472:available-parallelism-runtime, r=joshtriplett
Add caveat about changing parallelism and function call overhead

As discussed in https://github.com/rust-lang/rust/pull/89670#discussion_r728179584

r? ``@joshtriplett``
-rw-r--r--library/std/src/thread/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index b2aa500a0fd..1a5cf5ab822 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -1449,6 +1449,10 @@ fn _assert_sync_and_send() {
 /// global state in order to more accurately query the amount of available
 /// parallelism.
 ///
+/// Resource limits can be changed during the runtime of a program, therefore the value is
+/// not cached and instead recomputed every time this function is called. It should not be
+/// called from hot code.
+///
 /// The value returned by this function should be considered a simplified
 /// approximation of the actual amount of parallelism available at any given
 /// time. To get a more detailed or precise overview of the amount of