-pub fn min_stack() -> usize {
- static MIN: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
- match MIN.load(Ordering::SeqCst) {
- 0 => {}
- n => return n - 1,
- }
- let amt = env::var("RUST_MIN_STACK").ok().and_then(|s| s.parse().ok());
- #[cfg(not(target_os = "l4re"))]
- let amt = amt.unwrap_or(2 * 1024 * 1024);
- // L4Re only supports a maximum of 1Mb per default.
- #[cfg(target_os = "l4re")]
- let amt = amt.unwrap_or(1024 * 1024);
-
- // 0 is our sentinel value, so ensure that we'll never see 0 after
- // initialization has run
- MIN.store(amt + 1, Ordering::SeqCst);
- amt
-}
-