diff options
| author | bors <bors@rust-lang.org> | 2014-01-26 00:51:35 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-26 00:51:35 -0800 |
| commit | 838b5a4cc072057f31453cdd1b50345f92e1a772 (patch) | |
| tree | 258378080663b299b5be8b2ac9a3b0cda9ad609a /src/libstd/rt | |
| parent | e36032e9e1aac2ca428f3e17b5524b6c8fe9418c (diff) | |
| parent | 8c43ce6d943e31db4590009960abdf6d74cc02e4 (diff) | |
| download | rust-838b5a4cc072057f31453cdd1b50345f92e1a772.tar.gz rust-838b5a4cc072057f31453cdd1b50345f92e1a772.zip | |
auto merge of #11762 : alexcrichton/rust/guard_pages, r=alexcrichton
Rebasing of the previous PRs, I believe I've found the problems.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/env.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/rt/env.rs b/src/libstd/rt/env.rs index f3fa482b18c..729e377e1af 100644 --- a/src/libstd/rt/env.rs +++ b/src/libstd/rt/env.rs @@ -10,7 +10,7 @@ //! Runtime environment settings -use from_str::FromStr; +use from_str::from_str; use option::{Some, None}; use os; @@ -18,18 +18,25 @@ use os; // They are expected to be initialized once then left alone. static mut MIN_STACK: uint = 2 * 1024 * 1024; +/// This default corresponds to 20M of cache per scheduler (at the default size). +static mut MAX_CACHED_STACKS: uint = 10; static mut DEBUG_BORROW: bool = false; static mut POISON_ON_FREE: bool = false; pub fn init() { unsafe { match os::getenv("RUST_MIN_STACK") { - Some(s) => match FromStr::from_str(s) { + Some(s) => match from_str(s) { Some(i) => MIN_STACK = i, None => () }, None => () } + match os::getenv("RUST_MAX_CACHED_STACKS") { + Some(max) => MAX_CACHED_STACKS = from_str(max).expect("expected positive integer in \ + RUST_MAX_CACHED_STACKS"), + None => () + } match os::getenv("RUST_DEBUG_BORROW") { Some(_) => DEBUG_BORROW = true, None => () @@ -45,6 +52,10 @@ pub fn min_stack() -> uint { unsafe { MIN_STACK } } +pub fn max_cached_stacks() -> uint { + unsafe { MAX_CACHED_STACKS } +} + pub fn debug_borrow() -> bool { unsafe { DEBUG_BORROW } } |
