]> git.lizzy.rs Git - rust.git/commitdiff
Move the stack size value for L4Re to the min_stack_size function
authorSebastian Humenda <shumenda@gmx.de>
Thu, 7 Sep 2017 19:04:24 +0000 (21:04 +0200)
committerTobias Schaffner <tschaff@genua.de>
Fri, 8 Sep 2017 12:36:56 +0000 (14:36 +0200)
src/libstd/sys/unix/thread.rs
src/libstd/sys_common/util.rs

index 5e2610736a8dd16788f565696e57d00241a8c54e..60bce7924cdd8ee1ecfb82871ea303952a36335f 100644 (file)
@@ -53,10 +53,6 @@ pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
 
         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 => {}
index daa0c15920b666703f323463a8952a5e753d937e..41be6f4376348b0746a541a7453708b2561f300d 100644 (file)
@@ -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);