Skip to content

Commit 54567ef

Browse files
authored
Clarify that RUST_MIN_STACK is internally cached
For larger applications it's important that users set `RUST_MIN_STACK` at the start of their program because `min_stack` caches the value. Not doing so can lead to their `env::set_var` call surprisingly not having any effect.
1 parent 7ac4b82 commit 54567ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/std/src/thread/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
//!
132132
//! * Build the thread with [`Builder`] and pass the desired stack size to [`Builder::stack_size`].
133133
//! * Set the `RUST_MIN_STACK` environment variable to an integer representing the desired stack
134-
//! size (in bytes). Note that setting [`Builder::stack_size`] will override this.
134+
//! size (in bytes). Note that setting [`Builder::stack_size`] will override this. Also, note
135+
//! that `RUST_MIN_STACK` is cached internally so should be set before any threads are started.
135136
//!
136137
//! Note that the stack size of the main thread is *not* determined by Rust.
137138
//!

0 commit comments

Comments
 (0)