Skip to content

Commit 40794bf

Browse files
humendaTobias Schaffner
authored and
Tobias Schaffner
committed
Move the stack size value for L4Re to the min_stack_size function
1 parent 0b77464 commit 40794bf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/libstd/sys/unix/thread.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ impl Thread {
5353

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

56-
// L4Re only supports a maximum of 1Mb per default.
57-
#[cfg(target_os = "l4re")]
58-
let stack_size = cmp::min(stack_size, 1024 * 1024);
59-
6056
match pthread_attr_setstacksize(&mut attr,
6157
stack_size) {
6258
0 => {}

src/libstd/sys_common/util.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ pub fn min_stack() -> usize {
2222
n => return n - 1,
2323
}
2424
let amt = env::var("RUST_MIN_STACK").ok().and_then(|s| s.parse().ok());
25+
#[cfg(not(target_os = "l4re"))]
2526
let amt = amt.unwrap_or(2 * 1024 * 1024);
27+
// L4Re only supports a maximum of 1Mb per default.
28+
#[cfg(target_os = "l4re")]
29+
let amt = amt.unwrap_or(1024 * 1024);
30+
2631
// 0 is our sentinel value, so ensure that we'll never see 0 after
2732
// initialization has run
2833
MIN.store(amt + 1, Ordering::SeqCst);

0 commit comments

Comments
 (0)