Skip to content

Commit

Permalink
Move the stack size value for L4Re to the min_stack_size function
Browse files Browse the repository at this point in the history
  • Loading branch information
humenda authored and Tobias Schaffner committed Sep 8, 2017
1 parent 0b77464 commit 40794bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/libstd/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ impl Thread {

let stack_size = cmp::max(stack, min_stack_size(&attr));

// L4Re only supports a maximum of 1Mb per default.
#[cfg(target_os = "l4re")]
let stack_size = cmp::min(stack_size, 1024 * 1024);

match pthread_attr_setstacksize(&mut attr,
stack_size) {
0 => {}
Expand Down
5 changes: 5 additions & 0 deletions src/libstd/sys_common/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ pub fn min_stack() -> usize {
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);
Expand Down

0 comments on commit 40794bf

Please sign in to comment.